Guards for nSPV in decode/send raw transaction
This commit is contained in:
@@ -35,7 +35,6 @@ bool CKeyStore::GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CKeyStore::AddKey(const CKey &key) {
|
bool CKeyStore::AddKey(const CKey &key) {
|
||||||
fprintf(stderr,"addkey\n");
|
|
||||||
return AddKeyPubKey(key, key.GetPubKey());
|
return AddKeyPubKey(key, key.GetPubKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,12 +71,6 @@ bool CBasicKeyStore::AddKeyPubKey(const CKey& key, const CPubKey &pubkey)
|
|||||||
{
|
{
|
||||||
LOCK(cs_KeyStore);
|
LOCK(cs_KeyStore);
|
||||||
mapKeys[pubkey.GetID()] = key;
|
mapKeys[pubkey.GetID()] = key;
|
||||||
{
|
|
||||||
int32_t i;
|
|
||||||
for (i=0; i<33; i++)
|
|
||||||
fprintf(stderr,"%02x",((uint8_t *)&pubkey)[i]);
|
|
||||||
fprintf(stderr," addpubkey pub\n");
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
|
|||||||
entry.push_back(Pair("vin", vin));
|
entry.push_back(Pair("vin", vin));
|
||||||
UniValue vout(UniValue::VARR);
|
UniValue vout(UniValue::VARR);
|
||||||
BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
|
BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
|
||||||
CBlockIndex *tipindex,*pindex = it->second;
|
CBlockIndex *tipindex;//,*pindex = it->second;
|
||||||
uint64_t interest;
|
uint64_t interest;
|
||||||
for (unsigned int i = 0; i < tx.vout.size(); i++) {
|
for (unsigned int i = 0; i < tx.vout.size(); i++) {
|
||||||
const CTxOut& txout = tx.vout[i];
|
const CTxOut& txout = tx.vout[i];
|
||||||
@@ -1317,27 +1317,29 @@ UniValue sendrawtransaction(const UniValue& params, bool fHelp)
|
|||||||
bool fOverrideFees = false;
|
bool fOverrideFees = false;
|
||||||
if (params.size() > 1)
|
if (params.size() > 1)
|
||||||
fOverrideFees = params[1].get_bool();
|
fOverrideFees = params[1].get_bool();
|
||||||
|
if ( KOMODO_NSPV == 0 )
|
||||||
CCoinsViewCache &view = *pcoinsTip;
|
{
|
||||||
const CCoins* existingCoins = view.AccessCoins(hashTx);
|
CCoinsViewCache &view = *pcoinsTip;
|
||||||
bool fHaveMempool = mempool.exists(hashTx);
|
const CCoins* existingCoins = view.AccessCoins(hashTx);
|
||||||
bool fHaveChain = existingCoins && existingCoins->nHeight < 1000000000;
|
bool fHaveMempool = mempool.exists(hashTx);
|
||||||
if (!fHaveMempool && !fHaveChain) {
|
bool fHaveChain = existingCoins && existingCoins->nHeight < 1000000000;
|
||||||
// push to local node and sync with wallets
|
if (!fHaveMempool && !fHaveChain) {
|
||||||
CValidationState state;
|
// push to local node and sync with wallets
|
||||||
bool fMissingInputs;
|
CValidationState state;
|
||||||
if (!AcceptToMemoryPool(mempool, state, tx, false, &fMissingInputs, !fOverrideFees)) {
|
bool fMissingInputs;
|
||||||
if (state.IsInvalid()) {
|
if (!AcceptToMemoryPool(mempool, state, tx, false, &fMissingInputs, !fOverrideFees)) {
|
||||||
throw JSONRPCError(RPC_TRANSACTION_REJECTED, strprintf("%i: %s", state.GetRejectCode(), state.GetRejectReason()));
|
if (state.IsInvalid()) {
|
||||||
} else {
|
throw JSONRPCError(RPC_TRANSACTION_REJECTED, strprintf("%i: %s", state.GetRejectCode(), state.GetRejectReason()));
|
||||||
if (fMissingInputs) {
|
} else {
|
||||||
throw JSONRPCError(RPC_TRANSACTION_ERROR, "Missing inputs");
|
if (fMissingInputs) {
|
||||||
|
throw JSONRPCError(RPC_TRANSACTION_ERROR, "Missing inputs");
|
||||||
|
}
|
||||||
|
throw JSONRPCError(RPC_TRANSACTION_ERROR, state.GetRejectReason());
|
||||||
}
|
}
|
||||||
throw JSONRPCError(RPC_TRANSACTION_ERROR, state.GetRejectReason());
|
|
||||||
}
|
}
|
||||||
|
} else if (fHaveChain) {
|
||||||
|
throw JSONRPCError(RPC_TRANSACTION_ALREADY_IN_CHAIN, "transaction already in block chain");
|
||||||
}
|
}
|
||||||
} else if (fHaveChain) {
|
|
||||||
throw JSONRPCError(RPC_TRANSACTION_ALREADY_IN_CHAIN, "transaction already in block chain");
|
|
||||||
}
|
}
|
||||||
RelayTransaction(tx);
|
RelayTransaction(tx);
|
||||||
|
|
||||||
|
|||||||
@@ -44,10 +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))
|
||||||
{
|
|
||||||
fprintf(stderr,"couldnt find key\n");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
uint256 hash;
|
uint256 hash;
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user