Fixed a glitch in 1-conf miss

This commit is contained in:
kexkey
2021-12-13 12:00:03 -05:00
parent e8ed740d07
commit 305fa86bb8
2 changed files with 7 additions and 5 deletions

View File

@@ -41,7 +41,7 @@ manage_missed_conf() {
trace "[Entering manage_missed_conf()]"
local watches=$(sql "SELECT DISTINCT address FROM watching w LEFT JOIN watching_tx ON w.id = watching_id LEFT JOIN tx t ON t.id = tx_id WHERE watching AND imported AND (tx_id IS NULL OR t.confirmations=0) ORDER BY address")
local watches=$(sql "SELECT DISTINCT address FROM watching w LEFT JOIN watching_tx ON w.id = watching_id LEFT JOIN tx t ON t.id = tx_id WHERE watching AND imported ORDER BY address")
trace "[manage_missed_conf] watches=${watches}"
if [ ${#watches} -eq 0 ]; then
trace "[manage_missed_conf] Nothing missed!"
@@ -122,8 +122,10 @@ manage_missed_conf() {
trace "[manage_missed_conf] confirmations=${confirmations}"
if [ "${txtime}" -ge "${inserted_ts}" ]; then
# Broadcast after watch, we missed it!
trace "[manage_missed_conf] Mined after watch, we missed it!"
# Broadcast or mined after watch, we missed it!
trace "[manage_missed_conf] Broadcast or mined after watch, we missed it!"
# We skip the callbacks because do_callbacks is called right after in
# requesthandler.executecallbacks (where we're from)
confirmation "${latesttxid}" "true"
fi
fi

View File

@@ -116,8 +116,8 @@ test_manage_missed_1_conf() {
docker exec -it $(docker ps -q -f "name=cyphernode_bitcoin") bitcoin-cli -rpcwallet=spending01.dat sendtoaddress ${address} 0.0001
# txid1=$(exec_in_test_container curl -d '{"address":"'${address}'","amount":0.0001}' proxy:8888/spend | jq -r ".txid")
trace 3 "[test_manage_missed_1_conf] Sleeping for 10 seconds to let the 0-conf callbacks to happen..."
sleep 10
trace 3 "[test_manage_missed_1_conf] Sleeping for 20 seconds to let the 0-conf callbacks to happen..."
sleep 20
trace 3 "[test_manage_missed_1_conf] Shutting down the proxy..."
docker stop $(docker ps -q -f "name=proxy\.")