mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-01-31 23:32:16 +00:00
Fix manually-added transactions that make it into blocks.
This commit is contained in:
parent
c2cff6df41
commit
ca15e611ca
@ -866,7 +866,7 @@ public class Wallet implements Serializable, BlockChainListener, PeerFilterProvi
|
|||||||
if (spentBy != null) spentBy.disconnect();
|
if (spentBy != null) spentBy.disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
processTxFromBestChain(tx);
|
processTxFromBestChain(tx, wasPending);
|
||||||
} else {
|
} else {
|
||||||
checkState(sideChain);
|
checkState(sideChain);
|
||||||
// Transactions that appear in a side chain will have that appearance recorded below - we assume that
|
// 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
|
* 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.
|
* 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(lock.isHeldByCurrentThread());
|
||||||
checkState(!pending.containsKey(tx.getHash()));
|
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.
|
// Didn't send us any money, but did spend some. Keep it around for record keeping purposes.
|
||||||
log.info(" tx {} ->spent", tx.getHashAsString());
|
log.info(" tx {} ->spent", tx.getHashAsString());
|
||||||
addWalletTransaction(Pool.SPENT, tx);
|
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);
|
checkForDoubleSpendAgainstPending(tx, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user