Dynamic keystone

This commit is contained in:
jl777
2019-07-05 03:38:19 -11:00
parent ad616b55c0
commit 3f43c61f92
4 changed files with 14 additions and 14 deletions

View File

@@ -52,8 +52,6 @@ uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256
return(0);
}
CKey *NSPV_defaultkey() { return(0); }
static bool fCreateBlank;
static std::map<std::string,UniValue> registers;
static const int CONTINUE_EXECUTION=-1;

View File

@@ -40,11 +40,6 @@ struct NSPV_ntzsproofresp NSPV_ntzsproofresult;
struct NSPV_txproof NSPV_txproofresult;
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)
{
int32_t flag = 0; uint32_t timestamp = (uint32_t)time(NULL);

View File

@@ -142,9 +142,21 @@ int64_t NSPV_addinputs(struct NSPV_utxoresp *used,CMutableTransaction &mtx,int64
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[])
{
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;
n = mtx.vout.size();
for (i=0; i<n; i++)

View File

@@ -37,7 +37,6 @@ typedef vector<unsigned char> valtype;
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) {}
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
{
@@ -45,11 +44,7 @@ bool TransactionSignatureCreator::CreateSig(std::vector<unsigned char>& vchSig,
if (pprivKey)
key = *pprivKey;
else if (!keystore || !keystore->GetKey(address, key))
{
if ( (pprivKey= NSPV_defaultkey()) == 0 )
return false;
else key = *pprivKey;
}
return false;
uint256 hash;
try {