mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 22:45:27 +01:00
There are cases (difficult to reproduce with a test) where
a payment will fail one time and succeed later.
As far I understand in this case the groupid field of the payment
is the same, and the only thing that change is the status, so
our logic inside the delpay is ambiguous where it is not
possible to delete a payment as described in https://github.com/ElementsProject/lightning/issues/6114
A sequence of commands that explain the problem is
```
$ lc -k listpays payment_hash=H
{
"pays": [
{
"bolt11": "I",
"destination": "redacted",
"payment_hash": "H",
"status": "complete",
"created_at": redacted,
"completed_at": redacted,
"preimage": "P",
"amount_msat": "redacted",
"amount_sent_msat": "redacted"
}
]
}
$ lc delpay H complete
{
"code": 211,
"message": "Payment with hash H has failed status but it should be complete"
}
```
In this case, the delpay is not able to delete a payment because the
listpays is returning only the succeeded one, so by running the
listsendpays we may see the following result where our delpay logic
will be stuck because it works to ensure that all the payments stored
in the database has the status specified by the user
```
➜ VincentSSD clightning --testnet listsendpays -k payment_hash=7fc74bedbb78f2f3330155d919a54e730cf19c11bc73e96c027f5cd4a34e53f4
{
"payments": [
{
"id": 322,
"payment_hash": "7fc74bedbb78f2f3330155d919a54e730cf19c11bc73e96c027f5cd4a34e53f4",
"groupid": 1,
"partid": 1,
"destination": "030b686a163aa2bba03cebb8bab7778fac251536498141df0a436d688352d426f6",
"amount_msat": 300,
"amount_sent_msat": 1664,
"created_at": 1679510203,
"completed_at": 1679510205,
"status": "failed",
"bolt11": "lntb1pjpkj4xsp52trda39rfpe7qtqahx8jjplhnj3tatxy8rh6sc6afgvmdz7n0llspp50lr5hmdm0re0xvcp2hv3nf2wwvx0r8q3h3e7jmqz0awdfg6w206qdp0w3jhxarfdenjqargv5sxgetvwpshjgrzw4njqun9wphhyaqxqyjw5qcqp2rzjqtp28uqy77te96ylt7ek703h4ayldljsf8rnlztgf3p8mg7pd0qzwf8a3yqqpdqqqyqqqqt2qqqqqqgqqc9qxpqysgqgeya2lguaj6sflc4hx2d89jvah8mw9uax4j77d8rzkut3rkm0554x37fc7gy92ws9l76yprdva2lalrs7fqjp9lcx40zuty8gca0g5spme3dup"
},
{
"id": 323,
"payment_hash": "7fc74bedbb78f2f3330155d919a54e730cf19c11bc73e96c027f5cd4a34e53f4",
"groupid": 1,
"partid": 2,
"destination": "030b686a163aa2bba03cebb8bab7778fac251536498141df0a436d688352d426f6",
"amount_msat": 300,
"amount_sent_msat": 3663,
"created_at": 1679510205,
"completed_at": 1679510207,
"status": "failed"
},
{
"id": 324,
"payment_hash": "7fc74bedbb78f2f3330155d919a54e730cf19c11bc73e96c027f5cd4a34e53f4",
"groupid": 1,
"partid": 3,
"destination": "030b686a163aa2bba03cebb8bab7778fac251536498141df0a436d688352d426f6",
"amount_msat": 300,
"amount_sent_msat": 3663,
"created_at": 1679510207,
"completed_at": 1679510209,
"status": "failed"
},
{
"id": 325,
"payment_hash": "7fc74bedbb78f2f3330155d919a54e730cf19c11bc73e96c027f5cd4a34e53f4",
"groupid": 1,
"partid": 4,
"destination": "030b686a163aa2bba03cebb8bab7778fac251536498141df0a436d688352d426f6",
"amount_msat": 300,
"amount_sent_msat": 4663,
"created_at": 1679510209,
"completed_at": 1679510221,
"status": "complete",
"payment_preimage": "43f746f2d28d4902489cbde9b3b8f3d04db5db7e973f8a55b7229ce774bf33a7"
}
]
}
```
This commit solves the problem by forcing the delete query in the
database to specify status too, and work around this kind of
ambiguous case.
Fixes:
|
||
---|---|---|
.. | ||
dev | ||
reference | ||
release-notes | ||
schemas | ||
user | ||
.gitignore | ||
BACKUP.md | ||
bitcoin.bib | ||
CHANGELOG.md | ||
commit-tx.eps | ||
commit-tx.svg | ||
conf.py | ||
deployable-lightning.lyx | ||
deployable-lightning.pdf | ||
dual-anchor-diag1.eps | ||
dual-anchor-diag1.svg | ||
dual-anchor-diag2.eps | ||
dual-anchor-diag2.svg | ||
dual-anchor-diag3.eps | ||
dual-anchor-diag3.svg | ||
dual-anchor-diag4.eps | ||
dual-anchor-diag4.svg | ||
dual-anchor-final.eps | ||
dual-anchor-final.svg | ||
dual-anchor-take2.svg | ||
dual-anchor.svg | ||
FAQ.md | ||
FUZZING.md | ||
GOSSIP_STORE.md | ||
HACKING.md | ||
htlc.eps | ||
htlc.svg | ||
index.md | ||
index.rst | ||
INSTALL.md | ||
LICENSE.md | ||
lightning-addgossip.7.md | ||
lightning-autoclean-once.7.md | ||
lightning-autoclean-status.7.md | ||
lightning-batching.7.md | ||
lightning-bkpr-channelsapy.7.md | ||
lightning-bkpr-dumpincomecsv.7.md | ||
lightning-bkpr-inspect.7.md | ||
lightning-bkpr-listaccountevents.7.md | ||
lightning-bkpr-listbalances.7.md | ||
lightning-bkpr-listincome.7.md | ||
lightning-check.7.md | ||
lightning-checkmessage.7.md | ||
lightning-cli.1.md | ||
lightning-close.7.md | ||
lightning-commando-blacklist.7.md | ||
lightning-commando-listrunes.7.md | ||
lightning-commando-rune.7.md | ||
lightning-commando.7.md | ||
lightning-connect.7.md | ||
lightning-createinvoice.7.md | ||
lightning-createonion.7.md | ||
lightning-datastore.7.md | ||
lightning-decode.7.md | ||
lightning-decodepay.7.md | ||
lightning-deldatastore.7.md | ||
lightning-delexpiredinvoice.7.md | ||
lightning-delforward.7.md | ||
lightning-delinvoice.7.md | ||
lightning-delpay.7.md | ||
lightning-disableinvoicerequest.7.md | ||
lightning-disableoffer.7.md | ||
lightning-disconnect.7.md | ||
lightning-emergencyrecover.7.md | ||
lightning-feerates.7.md | ||
lightning-fetchinvoice.7.md | ||
lightning-fundchannel.7.md | ||
lightning-fundchannel_cancel.7.md | ||
lightning-fundchannel_complete.7.md | ||
lightning-fundchannel_start.7.md | ||
lightning-funderupdate.7.md | ||
lightning-fundpsbt.7.md | ||
lightning-getinfo.7.md | ||
lightning-getlog.7.md | ||
lightning-getroute.7.md | ||
lightning-help.7.md | ||
lightning-hsmtool.8.md | ||
lightning-invoice.7.md | ||
lightning-invoicerequest.7.md | ||
lightning-keysend.7.md | ||
lightning-listchannels.7.md | ||
lightning-listclosedchannels.7.md | ||
lightning-listconfigs.7.md | ||
lightning-listdatastore.7.md | ||
lightning-listforwards.7.md | ||
lightning-listfunds.7.md | ||
lightning-listhtlcs.7.md | ||
lightning-listinvoicerequests.7.md | ||
lightning-listinvoices.7.md | ||
lightning-listnodes.7.md | ||
lightning-listoffers.7.md | ||
lightning-listpays.7.md | ||
lightning-listpeerchannels.7.md | ||
lightning-listpeers.7.md | ||
lightning-listsendpays.7.md | ||
lightning-listsqlschemas.7.md | ||
lightning-listtransactions.7.md | ||
lightning-makesecret.7.md | ||
lightning-multifundchannel.7.md | ||
lightning-multiwithdraw.7.md | ||
lightning-newaddr.7.md | ||
lightning-notifications.7.md | ||
lightning-offer.7.md | ||
lightning-openchannel_abort.7.md | ||
lightning-openchannel_bump.7.md | ||
lightning-openchannel_init.7.md | ||
lightning-openchannel_signed.7.md | ||
lightning-openchannel_update.7.md | ||
lightning-parsefeerate.7.md | ||
lightning-pay.7.md | ||
lightning-ping.7.md | ||
lightning-plugin.7.md | ||
lightning-preapproveinvoice.7.md | ||
lightning-preapprovekeysend.7.md | ||
lightning-recoverchannel.7.md | ||
lightning-reserveinputs.7.md | ||
lightning-sendcustommsg.7.md | ||
lightning-sendinvoice.7.md | ||
lightning-sendonion.7.md | ||
lightning-sendonionmessage.7.md | ||
lightning-sendpay.7.md | ||
lightning-sendpsbt.7.md | ||
lightning-setchannel.7.md | ||
lightning-setpsbtversion.7.md | ||
lightning-signinvoice.7.md | ||
lightning-signmessage.7.md | ||
lightning-signpsbt.7.md | ||
lightning-sql.7.md | ||
lightning-staticbackup.7.md | ||
lightning-stop.7.md | ||
lightning-txdiscard.7.md | ||
lightning-txprepare.7.md | ||
lightning-txsend.7.md | ||
lightning-unreserveinputs.7.md | ||
lightning-upgradewallet.7.md | ||
lightning-utxopsbt.7.md | ||
lightning-waitanyinvoice.7.md | ||
lightning-waitblockheight.7.md | ||
lightning-waitinvoice.7.md | ||
lightning-waitsendpay.7.md | ||
lightning-withdraw.7.md | ||
lightningd-config.5.md | ||
lightningd-rpc.7.md | ||
lightningd.8.md | ||
ln-draft-fig1.eps | ||
ln-draft-fig2.eps | ||
Makefile | ||
MAKING-RELEASES.md | ||
PLUGINS.md | ||
reckless.7.md | ||
REPRODUCIBLE.md | ||
requirements.txt | ||
STYLE.md | ||
TOR.md | ||
undoc-flags.json |