Dynamic keystone
This commit is contained in:
@@ -52,8 +52,6 @@ uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
CKey *NSPV_defaultkey() { return(0); }
|
|
||||||
|
|
||||||
static bool fCreateBlank;
|
static bool fCreateBlank;
|
||||||
static std::map<std::string,UniValue> registers;
|
static std::map<std::string,UniValue> registers;
|
||||||
static const int CONTINUE_EXECUTION=-1;
|
static const int CONTINUE_EXECUTION=-1;
|
||||||
|
|||||||
@@ -40,11 +40,6 @@ struct NSPV_ntzsproofresp NSPV_ntzsproofresult;
|
|||||||
struct NSPV_txproof NSPV_txproofresult;
|
struct NSPV_txproof NSPV_txproofresult;
|
||||||
struct NSPV_utxo *NSPV_utxos;
|
struct NSPV_utxo *NSPV_utxos;
|
||||||
|
|
||||||
CKey *NSPV_defaultkey()
|
|
||||||
{
|
|
||||||
return(&NSPV_key);
|
|
||||||
}
|
|
||||||
|
|
||||||
CNode *NSPV_req(CNode *pnode,uint8_t *msg,int32_t len,uint64_t mask,int32_t ind)
|
CNode *NSPV_req(CNode *pnode,uint8_t *msg,int32_t len,uint64_t mask,int32_t ind)
|
||||||
{
|
{
|
||||||
int32_t flag = 0; uint32_t timestamp = (uint32_t)time(NULL);
|
int32_t flag = 0; uint32_t timestamp = (uint32_t)time(NULL);
|
||||||
|
|||||||
@@ -142,9 +142,21 @@ int64_t NSPV_addinputs(struct NSPV_utxoresp *used,CMutableTransaction &mtx,int64
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NSPV_SignTx(CMutableTransaction &mtx,int32_t vini,int64_t utxovalue,const CScript scriptPubKey)
|
||||||
|
{
|
||||||
|
CTransaction txNewConst(mtx); SignatureData sigdata; const CKeyStore &keystore;
|
||||||
|
auto consensusBranchId = CurrentEpochBranchId(chainActive.Height() + 1, Params().GetConsensus());
|
||||||
|
keystore.AddKey(NSPV_key);
|
||||||
|
if ( ProduceSignature(TransactionSignatureCreator(&keystore,&txNewConst,vini,utxovalue,SIGHASH_ALL),scriptPubKey,sigdata,consensusBranchId) != 0 )
|
||||||
|
{
|
||||||
|
UpdateTransaction(mtx,vini,sigdata);
|
||||||
|
return(true);
|
||||||
|
} else fprintf(stderr,"signing error for SignTx vini.%d %.8f\n",vini,(double)utxovalue/COIN);
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
|
||||||
std::string NSPV_signtx(CMutableTransaction &mtx,uint64_t txfee,CScript opret,struct NSPV_utxoresp used[])
|
std::string NSPV_signtx(CMutableTransaction &mtx,uint64_t txfee,CScript opret,struct NSPV_utxoresp used[])
|
||||||
{
|
{
|
||||||
auto consensusBranchId = CurrentEpochBranchId(chainActive.Height() + 1, Params().GetConsensus());
|
|
||||||
CTransaction vintx; std::string hex; uint256 hashBlock; int64_t change,totaloutputs=0,totalinputs=0; int32_t i,utxovout,n;
|
CTransaction vintx; std::string hex; uint256 hashBlock; int64_t change,totaloutputs=0,totalinputs=0; int32_t i,utxovout,n;
|
||||||
n = mtx.vout.size();
|
n = mtx.vout.size();
|
||||||
for (i=0; i<n; i++)
|
for (i=0; i<n; i++)
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ typedef vector<unsigned char> valtype;
|
|||||||
extern uint8_t ASSETCHAINS_TXPOW;
|
extern uint8_t ASSETCHAINS_TXPOW;
|
||||||
|
|
||||||
TransactionSignatureCreator::TransactionSignatureCreator(const CKeyStore* keystoreIn, const CTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn, int nHashTypeIn) : BaseSignatureCreator(keystoreIn), txTo(txToIn), nIn(nInIn), nHashType(nHashTypeIn), amount(amountIn), checker(txTo, nIn, amountIn) {}
|
TransactionSignatureCreator::TransactionSignatureCreator(const CKeyStore* keystoreIn, const CTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn, int nHashTypeIn) : BaseSignatureCreator(keystoreIn), txTo(txToIn), nIn(nInIn), nHashType(nHashTypeIn), amount(amountIn), checker(txTo, nIn, amountIn) {}
|
||||||
CKey *NSPV_defaultkey();
|
|
||||||
|
|
||||||
bool TransactionSignatureCreator::CreateSig(std::vector<unsigned char>& vchSig, const CKeyID& address, const CScript& scriptCode, uint32_t consensusBranchId, CKey *pprivKey, void *extraData) const
|
bool TransactionSignatureCreator::CreateSig(std::vector<unsigned char>& vchSig, const CKeyID& address, const CScript& scriptCode, uint32_t consensusBranchId, CKey *pprivKey, void *extraData) const
|
||||||
{
|
{
|
||||||
@@ -45,11 +44,7 @@ bool TransactionSignatureCreator::CreateSig(std::vector<unsigned char>& vchSig,
|
|||||||
if (pprivKey)
|
if (pprivKey)
|
||||||
key = *pprivKey;
|
key = *pprivKey;
|
||||||
else if (!keystore || !keystore->GetKey(address, key))
|
else if (!keystore || !keystore->GetKey(address, key))
|
||||||
{
|
return false;
|
||||||
if ( (pprivKey= NSPV_defaultkey()) == 0 )
|
|
||||||
return false;
|
|
||||||
else key = *pprivKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint256 hash;
|
uint256 hash;
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user