This commit is contained in:
jl777
2019-07-10 21:42:51 -11:00
parent cdac925795
commit 40f2cf29c4
3 changed files with 14 additions and 15 deletions

View File

@@ -431,6 +431,7 @@ UniValue NSPV_broadcast_json(struct NSPV_broadcastresp *ptr,uint256 txid)
UniValue NSPV_login(char *wifstr) UniValue NSPV_login(char *wifstr)
{ {
UniValue result(UniValue::VOBJ); char coinaddr[64]; uint8_t data[128]; int32_t len,valid = 0; UniValue result(UniValue::VOBJ); char coinaddr[64]; uint8_t data[128]; int32_t len,valid = 0;
NSPV_logout();
len = bitcoin_base58decode(data,wifstr); len = bitcoin_base58decode(data,wifstr);
if ( strlen(wifstr) < 64 && (len == 38 && data[len-5] == 1) || (len == 37 && data[len-5] != 1) ) if ( strlen(wifstr) < 64 && (len == 38 && data[len-5] == 1) || (len == 37 && data[len-5] != 1) )
valid = 1; valid = 1;

View File

@@ -238,10 +238,14 @@ bool NSPV_SignTx(CMutableTransaction &mtx,int32_t vini,int64_t utxovalue,const C
fprintf(stderr,"use legacy sig validation\n"); fprintf(stderr,"use legacy sig validation\n");
branchid = 0; branchid = 0;
} }
mtx.fOverwintered = true;
mtx.nExpiryHeight = 0;
mtx.nVersionGroupId = SAPLING_VERSION_GROUP_ID;
mtx.nVersion = branchid;
if ( ProduceSignature(TransactionSignatureCreator(&keystore,&txNewConst,vini,utxovalue,SIGHASH_ALL),scriptPubKey,sigdata,branchid) != 0 ) if ( ProduceSignature(TransactionSignatureCreator(&keystore,&txNewConst,vini,utxovalue,SIGHASH_ALL),scriptPubKey,sigdata,branchid) != 0 )
{ {
UpdateTransaction(mtx,vini,sigdata); UpdateTransaction(mtx,vini,sigdata);
// fprintf(stderr,"SIG_TXHASH %s vini.%d %.8f\n",SIG_TXHASH.GetHex().c_str(),vini,(double)utxovalue/COIN); fprintf(stderr,"SIG_TXHASH %s vini.%d %.8f\n",SIG_TXHASH.GetHex().c_str(),vini,(double)utxovalue/COIN);
return(true); return(true);
} else fprintf(stderr,"sigerr SIG_TXHASH %s vini.%d %.8f\n",SIG_TXHASH.GetHex().c_str(),vini,(double)utxovalue/COIN); } else fprintf(stderr,"sigerr SIG_TXHASH %s vini.%d %.8f\n",SIG_TXHASH.GetHex().c_str(),vini,(double)utxovalue/COIN);
return(false); return(false);
@@ -358,10 +362,6 @@ UniValue NSPV_spend(char *srcaddr,char *destaddr,int64_t satoshis) // what its a
} }
printf("%s numutxos.%d balance %.8f\n",NSPV_utxosresult.coinaddr,NSPV_utxosresult.numutxos,(double)NSPV_utxosresult.total/COIN); printf("%s numutxos.%d balance %.8f\n",NSPV_utxosresult.coinaddr,NSPV_utxosresult.numutxos,(double)NSPV_utxosresult.total/COIN);
CScript opret; std::string hex; struct NSPV_utxoresp used[NSPV_MAXVINS]; CMutableTransaction mtx; CTransaction tx; int64_t rewardsum=0,interestsum=0; CScript opret; std::string hex; struct NSPV_utxoresp used[NSPV_MAXVINS]; CMutableTransaction mtx; CTransaction tx; int64_t rewardsum=0,interestsum=0;
mtx.fOverwintered = true;
mtx.nExpiryHeight = 0;
mtx.nVersionGroupId = SAPLING_VERSION_GROUP_ID;
mtx.nVersion = SAPLING_TX_VERSION;
if ( ASSETCHAINS_SYMBOL[0] == 0 ) if ( ASSETCHAINS_SYMBOL[0] == 0 )
mtx.nLockTime = (uint32_t)time(NULL) - 777; mtx.nLockTime = (uint32_t)time(NULL) - 777;
memset(used,0,sizeof(used)); memset(used,0,sizeof(used));

View File

@@ -2224,6 +2224,7 @@ bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlo
{ {
int64_t rewardsum = 0; int32_t retval,vout = 0; int64_t rewardsum = 0; int32_t retval,vout = 0;
retval = NSPV_gettransaction(1,vout,hash,0,txOut,0,0,rewardsum); retval = NSPV_gettransaction(1,vout,hash,0,txOut,0,0,rewardsum);
fprintf(stderr,"myGetTransaction retval.%d\n",retval);
return(retval == 0); return(retval == 0);
} }
// need a GetTransaction without lock so the validation code for assets can run without deadlock // need a GetTransaction without lock so the validation code for assets can run without deadlock
@@ -8467,23 +8468,20 @@ CMutableTransaction CreateNewContextualCMutableTransaction(const Consensus::Para
{ {
CMutableTransaction mtx; CMutableTransaction mtx;
bool isOverwintered = NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_OVERWINTER) || (KOMODO_NSPV != 0); bool isOverwintered = NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_OVERWINTER);
if (isOverwintered) { if (isOverwintered) {
mtx.fOverwintered = true; mtx.fOverwintered = true;
if ( KOMODO_NSPV == 0 ) mtx.nExpiryHeight = nHeight + expiryDelta;
mtx.nExpiryHeight = nHeight + expiryDelta;
if ( NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_SAPLING) || (KOMODO_NSPV != 0) ) if (NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_SAPLING)) {
{
mtx.nVersionGroupId = SAPLING_VERSION_GROUP_ID; mtx.nVersionGroupId = SAPLING_VERSION_GROUP_ID;
mtx.nVersion = SAPLING_TX_VERSION; mtx.nVersion = SAPLING_TX_VERSION;
} } else {
else
{
mtx.nVersionGroupId = OVERWINTER_VERSION_GROUP_ID; mtx.nVersionGroupId = OVERWINTER_VERSION_GROUP_ID;
mtx.nVersion = OVERWINTER_TX_VERSION; mtx.nVersion = OVERWINTER_TX_VERSION;
mtx.nExpiryHeight = std::min(mtx.nExpiryHeight, mtx.nExpiryHeight = std::min(
static_cast<uint32_t>(consensusParams.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight -1)); mtx.nExpiryHeight,
static_cast<uint32_t>(consensusParams.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight - 1));
} }
} }
return mtx; return mtx;