3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-01-31 15:22:16 +00:00

Fix manually-added transactions that make it into blocks.

This commit is contained in:
Matt Corallo 2013-07-30 17:53:46 +02:00 committed by Mike Hearn
parent c2cff6df41
commit ca15e611ca

View File

@ -866,7 +866,7 @@ public class Wallet implements Serializable, BlockChainListener, PeerFilterProvi
if (spentBy != null) spentBy.disconnect();
}
}
processTxFromBestChain(tx);
processTxFromBestChain(tx, wasPending);
} else {
checkState(sideChain);
// Transactions that appear in a side chain will have that appearance recorded below - we assume that
@ -995,7 +995,7 @@ public class Wallet implements Serializable, BlockChainListener, PeerFilterProvi
* Handle when a transaction becomes newly active on the best chain, either due to receiving a new block or a
* re-org. Places the tx into the right pool, handles coinbase transactions, handles double-spends and so on.
*/
private void processTxFromBestChain(Transaction tx) throws VerificationException {
private void processTxFromBestChain(Transaction tx, boolean forceAddToPool) throws VerificationException {
checkState(lock.isHeldByCurrentThread());
checkState(!pending.containsKey(tx.getHash()));
@ -1032,6 +1032,10 @@ public class Wallet implements Serializable, BlockChainListener, PeerFilterProvi
// Didn't send us any money, but did spend some. Keep it around for record keeping purposes.
log.info(" tx {} ->spent", tx.getHashAsString());
addWalletTransaction(Pool.SPENT, tx);
} else if (forceAddToPool) {
// Was manually added to pending, so we should keep it to notify the user of confidence information
log.info(" tx {} ->spent (manually added)", tx.getHashAsString());
addWalletTransaction(Pool.SPENT, tx);
}
checkForDoubleSpendAgainstPending(tx, true);