mirror of
https://github.com/aljazceru/lspd.git
synced 2025-12-19 14:54:22 +01:00
insert htlc used for channel open
This commit is contained in:
@@ -345,3 +345,29 @@ func (s *HistoryStore) SetClnForwardOffsets(
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *HistoryStore) AddOpenChannelHtlc(ctx context.Context, htlc *history.OpenChannelHtlc) error {
|
||||
// TODO: Find an identifier equal to the forwarding_history identifier.
|
||||
_, err := s.pool.Exec(ctx, `
|
||||
INSERT INTO open_channel_htlcs (
|
||||
nodeid
|
||||
, peerid
|
||||
, funding_tx_id
|
||||
, funding_tx_outnum
|
||||
, forward_amt_msat
|
||||
, original_amt_msat
|
||||
, incoming_amt_msat
|
||||
, forward_time
|
||||
) VALUES ($1, $2, $3, $4, $5, $6, $7)
|
||||
`,
|
||||
htlc.NodeId,
|
||||
htlc.PeerId,
|
||||
htlc.ChannelPoint.Hash[:],
|
||||
htlc.ChannelPoint.Index,
|
||||
int64(htlc.ForwardAmountMsat),
|
||||
int64(htlc.OriginalAmountMsat),
|
||||
int64(htlc.IncomingAmountMsat),
|
||||
htlc.ForwardTime.UnixNano(),
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
1
postgresql/migrations/000016_open_channel_htlc.down.sql
Normal file
1
postgresql/migrations/000016_open_channel_htlc.down.sql
Normal file
@@ -0,0 +1 @@
|
||||
DROP TABLE public.open_channel_htlcs;
|
||||
9
postgresql/migrations/000016_open_channel_htlc.up.sql
Normal file
9
postgresql/migrations/000016_open_channel_htlc.up.sql
Normal file
@@ -0,0 +1,9 @@
|
||||
CREATE TABLE public.open_channel_htlcs (
|
||||
nodeid bytea NOT NULL,
|
||||
peerid bytea NOT NULL,
|
||||
funding_tx_id bytea NOT NULL,
|
||||
funding_tx_outnum bigint NOT NULL,
|
||||
forward_amt_msat bigint NOT NULL,
|
||||
original_amt_msat bigint NOT NULL,
|
||||
forward_time bigint NOT NULL
|
||||
);
|
||||
Reference in New Issue
Block a user