-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
commands: indicate in listcoins
response whether coin is from self
#1483
commands: indicate in listcoins
response whether coin is from self
#1483
Conversation
Some migration tests used structs and methods that are expected to change and so will not be backward compatible. This change replaces those with structs and methods specific to the migration tests so that the tests will be unaffected by DB schema changes. At the same time, these new structs and methods simplify some of the setup by allowing to store new coins, including their confirmation and spend status, in a single DB operation.
bbcfb76
to
07b2651
Compare
Set PR to draft as I might include changes to the |
07b2651
to
3118ee4
Compare
I added commits to include the I also added a check constraint on the coins table so that a coin cannot be both immature and from self. This would also apply to coinbase deposits in general, but we don't currently flag those. |
listcoins
response whether coin is from self
Following feedback from @edouardparis, I'll make the following changes:
|
I found that making changes to the transactions used in the test can affect the order in which coins are returned, probably due to the txid changing.
The new columns in the transactions table will be populated for new transactions by the poller, while existing rows will be updated in a subsequent migration. New and existing coins will all have `is_from_self` set to false due to the default column value. None of these columns will be used by the wallet at this stage.
3118ee4
to
16726f5
Compare
I've now made the changes as outlined above. For extra safety, I added a max number of iterations based on the number of unconfirmed coins when updating |
This populates the new columns from the previous migration for existing rows and then maintains them in the poller moving forward.
16726f5
to
1c03386
Compare
utACK 1c03386 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 1c03386
…alance 715aeb9 gui(lianalite): use is_from_self from response (Michael Mallan) 8d99981 gui: include unconfirmed from self in confirmed balance (Michael Mallan) 31224ba gui: set missing fields for new home page (Michael Mallan) 0a4861f refactor(gui): use common function for coins summary (Michael Mallan) Pull request description: This is to complete #1375, building on the changes from #1483. The Liana Connect API response has been updated to include `is_from_self` so this will work for both local and remote backends. ACKs for top commit: edouardparis: utACK 715aeb9 Tree-SHA512: 905494ee29f19dd527b2b1173075e6f2c332030b00ec05aca680921fc50411fee0d65977d2ee29b82fcfb07472df7717d8844a60cd629ffd8850d77c29b4f71e
This is a first step towards #1375.
Following the approach from #1391, this PR adds a new
is_from_self
field to the response of thelistcoins
command.The underlying information is stored in a new
is_from_self
column in the coins database table. This column could instead have been added to the transactions table, but for consistency with other transaction-related columns, I added it to the coins table. It's also important to note that being from self is wallet-dependent, so adding it to the transactions table would not work if multiple wallets were supported in the same DB (h/t edouardparis).A subsequent PR will then use this field in the GUI to determine which unconfirmed coins, if any, can be included in the confirmed balance. It also needs to be added to the corresponding Liana Connect API call. Another use of this field will be to determine which unconfirmed coins to include in coin selection (#1484).
The first commit in this PR refactors some existing DB migration tests so that they will not be affected by future changes to the coins table schema.