-
Notifications
You must be signed in to change notification settings - Fork 120
staticaddr: persist withdrawal info #938
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
base: master
Are you sure you want to change the base?
Changes from all commits
d5722e4
eaeb9e7
9d0c423
cc1d386
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP TABLE IF EXISTS withdrawals; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
-- withdrawals stores finalized static address withdrawals. | ||
CREATE TABLE IF NOT EXISTS withdrawals ( | ||
-- id is the auto-incrementing primary key for a withdrawal. | ||
id INTEGER PRIMARY KEY, | ||
|
||
-- withdrawal_tx_id is the transaction tx id of the withdrawal. | ||
withdrawal_tx_id TEXT NOT NULL UNIQUE, | ||
|
||
-- deposit_outpoints is a concatenated list of outpoints that are used for | ||
-- this withdrawal. The list has the format txid1:idx;txid2:idx;... | ||
deposit_outpoints TEXT NOT NULL, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could it make sense to really sqlize this? and reference the db deposit id? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 |
||
|
||
-- total_deposit_amount is the total amount of the deposits in satoshis. | ||
total_deposit_amount BIGINT NOT NULL, | ||
|
||
-- withdrawn_amount is the total amount of the withdrawal. It amounts | ||
-- to the total amount of the deposits minus the fees and optional change. | ||
withdrawn_amount BIGINT NOT NULL, | ||
|
||
-- change_amount is the optional change that the user selected. | ||
change_amount BIGINT NOT NULL, | ||
|
||
-- confirmation_height is the block height at which the withdrawal was | ||
-- first confirmed. | ||
confirmation_height BIGINT NOT NULL | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be allowed to be |
||
); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
-- name: CreateWithdrawal :exec | ||
INSERT INTO withdrawals ( | ||
withdrawal_tx_id, | ||
deposit_outpoints, | ||
total_deposit_amount, | ||
withdrawn_amount, | ||
change_amount, | ||
confirmation_height | ||
) VALUES ( | ||
$1, | ||
$2, | ||
$3, | ||
$4, | ||
$5, | ||
$6 | ||
); | ||
|
||
-- name: AllWithdrawals :many | ||
SELECT | ||
* | ||
FROM | ||
withdrawals | ||
ORDER BY | ||
id ASC; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
I think it'd be nice to add an
initiated_at
column to this table, so that we can then filter on that on the cli too.