Open rahuldotar opened 4 years ago
I don't really understand what situation you're in. Could you give a bit more information?
I created the Elements blockchain network and implemented the Block signing federation using Kafka. Then I issued an asset and did the multiple transactions. After 2 multiple consecutive transactions with the same amount from the same wallet and one of that transaction failed. And I noticed that in the transaction details the param trusted is return as false and I lost the remaining balance in that wallet.
This is how the "trusted"
field works:
bool CWalletTx::IsTrusted(interfaces::Chain::Lock& locked_chain) const
{
LockAnnotation lock(::cs_main); // Temporary, for CheckFinalTx below. Removed in upcoming commit.
// Quick answer in most cases
if (!CheckFinalTx(*tx))
return false;
int nDepth = GetDepthInMainChain(locked_chain);
if (nDepth >= 1)
return true;
if (nDepth < 0)
return false;
if (!pwallet->m_spend_zero_conf_change || !IsFromMe(ISMINE_ALL)) // using wtx's cached debit
return false;
// Don't trust unconfirmed transactions from us unless they are in the mempool.
if (!InMempool())
return false;
// Trusted if all inputs are from us and are in the mempool:
for (const CTxIn& txin : tx->vin)
{
// Transactions not sent by us: not trusted
const CWalletTx* parent = pwallet->GetWalletTx(txin.prevout.hash);
if (parent == nullptr)
return false;
const CTxOut& parentOut = parent->tx->vout[txin.prevout.n];
if (pwallet->IsMine(parentOut) != ISMINE_SPENDABLE)
return false;
}
return true;
}
So it can be that the tx is dropped from the mempool for some reason. Did you accidentally double-spend the same coins?
After this transaction, the asset balance is not showing as expected. When I check the transaction history using
listtransaction
function and manually calculate the balance it is not matching with thegetbalance
function.