mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
reservation: add protocol version
This commit is contained in:
parent
a889d6226b
commit
56848d0cfa
11 changed files with 75 additions and 21 deletions
|
|
@ -0,0 +1,3 @@
|
|||
-- protocol_version is used to determine the version of the reservation protocol
|
||||
-- that was used to create the reservation.
|
||||
ALTER TABLE reservations DROP COLUMN protocol_Version;
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
-- protocol_version is used to determine the version of the reservation protocol
|
||||
-- that was used to create the reservation.
|
||||
ALTER TABLE reservations ADD COLUMN protocol_Version INTEGER NOT NULL DEFAULT 0;
|
||||
|
|
@ -113,6 +113,7 @@ type Reservation struct {
|
|||
TxHash []byte
|
||||
OutIndex sql.NullInt32
|
||||
ConfirmationHeight sql.NullInt32
|
||||
ProtocolVersion int32
|
||||
}
|
||||
|
||||
type ReservationUpdate struct {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ INSERT INTO reservations (
|
|||
value,
|
||||
client_key_family,
|
||||
client_key_index,
|
||||
initiation_height
|
||||
initiation_height,
|
||||
protocol_version
|
||||
) VALUES (
|
||||
$1,
|
||||
$2,
|
||||
|
|
@ -16,7 +17,8 @@ INSERT INTO reservations (
|
|||
$5,
|
||||
$6,
|
||||
$7,
|
||||
$8
|
||||
$8,
|
||||
$9
|
||||
);
|
||||
|
||||
-- name: UpdateReservation :exec
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ INSERT INTO reservations (
|
|||
value,
|
||||
client_key_family,
|
||||
client_key_index,
|
||||
initiation_height
|
||||
initiation_height,
|
||||
protocol_version
|
||||
) VALUES (
|
||||
$1,
|
||||
$2,
|
||||
|
|
@ -29,7 +30,8 @@ INSERT INTO reservations (
|
|||
$5,
|
||||
$6,
|
||||
$7,
|
||||
$8
|
||||
$8,
|
||||
$9
|
||||
)
|
||||
`
|
||||
|
||||
|
|
@ -42,6 +44,7 @@ type CreateReservationParams struct {
|
|||
ClientKeyFamily int32
|
||||
ClientKeyIndex int32
|
||||
InitiationHeight int32
|
||||
ProtocolVersion int32
|
||||
}
|
||||
|
||||
func (q *Queries) CreateReservation(ctx context.Context, arg CreateReservationParams) error {
|
||||
|
|
@ -54,13 +57,14 @@ func (q *Queries) CreateReservation(ctx context.Context, arg CreateReservationPa
|
|||
arg.ClientKeyFamily,
|
||||
arg.ClientKeyIndex,
|
||||
arg.InitiationHeight,
|
||||
arg.ProtocolVersion,
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
const getReservation = `-- name: GetReservation :one
|
||||
SELECT
|
||||
id, reservation_id, client_pubkey, server_pubkey, expiry, value, client_key_family, client_key_index, initiation_height, tx_hash, out_index, confirmation_height
|
||||
id, reservation_id, client_pubkey, server_pubkey, expiry, value, client_key_family, client_key_index, initiation_height, tx_hash, out_index, confirmation_height, protocol_version
|
||||
FROM
|
||||
reservations
|
||||
WHERE
|
||||
|
|
@ -83,6 +87,7 @@ func (q *Queries) GetReservation(ctx context.Context, reservationID []byte) (Res
|
|||
&i.TxHash,
|
||||
&i.OutIndex,
|
||||
&i.ConfirmationHeight,
|
||||
&i.ProtocolVersion,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
|
@ -128,7 +133,7 @@ func (q *Queries) GetReservationUpdates(ctx context.Context, reservationID []byt
|
|||
|
||||
const getReservations = `-- name: GetReservations :many
|
||||
SELECT
|
||||
id, reservation_id, client_pubkey, server_pubkey, expiry, value, client_key_family, client_key_index, initiation_height, tx_hash, out_index, confirmation_height
|
||||
id, reservation_id, client_pubkey, server_pubkey, expiry, value, client_key_family, client_key_index, initiation_height, tx_hash, out_index, confirmation_height, protocol_version
|
||||
FROM
|
||||
reservations
|
||||
ORDER BY
|
||||
|
|
@ -157,6 +162,7 @@ func (q *Queries) GetReservations(ctx context.Context) ([]Reservation, error) {
|
|||
&i.TxHash,
|
||||
&i.OutIndex,
|
||||
&i.ConfirmationHeight,
|
||||
&i.ProtocolVersion,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue