Skip to content

Commit 1407a6e

Browse files
committed
staticaddr: add swap hash to deposit structs
1 parent f54d580 commit 1407a6e

File tree

6 files changed

+413
-384
lines changed

6 files changed

+413
-384
lines changed

loopd/swapclient_server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1924,6 +1924,7 @@ func filter(deposits []*deposit.Deposit, f filterFunc) []*looprpc.Deposit {
19241924
Outpoint: outpoint,
19251925
Value: int64(d.Value),
19261926
ConfirmationHeight: d.ConfirmationHeight,
1927+
SwapHash: d.SwapHash,
19271928
}
19281929

19291930
clientDeposits = append(clientDeposits, deposit)

looprpc/client.pb.go

Lines changed: 396 additions & 384 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

looprpc/client.proto

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1910,6 +1910,12 @@ message Deposit {
19101910
loop-in swap anymore.
19111911
*/
19121912
int64 blocks_until_expiry = 6;
1913+
1914+
/*
1915+
The swap hash of the swap that this deposit is part of. This field is only
1916+
set if the deposit is part of a loop-in swap.
1917+
*/
1918+
bytes swap_hash = 7;
19131919
}
19141920

19151921
message StaticAddressWithdrawal {

looprpc/client.swagger.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,11 @@
860860
"type": "string",
861861
"format": "int64",
862862
"description": "The number of blocks that are left until the deposit cannot be used for a\nloop-in swap anymore."
863+
},
864+
"swap_hash": {
865+
"type": "string",
866+
"format": "byte",
867+
"description": "The swap hash of the swap that this deposit is part of. This field is only\nset if the deposit is part of a loop-in swap."
863868
}
864869
}
865870
},

staticaddr/deposit/deposit.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ type Deposit struct {
5252
// ExpirySweepTxid is the transaction id of the expiry sweep.
5353
ExpirySweepTxid chainhash.Hash
5454

55+
// SwapHash is an optional reference to a static address loop-in swap
56+
// that used this deposit. Nil if the deposit was not used in a swap.
57+
SwapHash []byte
58+
5559
// FinalizedWithdrawalTx is the coop signed withdrawal transaction. It
5660
// is republished on new block arrivals and on client restarts.
5761
FinalizedWithdrawalTx *wire.MsgTx

staticaddr/deposit/sql_store.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ func ToDeposit(row sqlc.Deposit, lastUpdate sqlc.DepositUpdate) (*Deposit,
281281
ConfirmationHeight: row.ConfirmationHeight,
282282
TimeOutSweepPkScript: row.TimeoutSweepPkScript,
283283
ExpirySweepTxid: expirySweepTxid,
284+
SwapHash: row.SwapHash,
284285
FinalizedWithdrawalTx: finalizedWithdrawalTx,
285286
}, nil
286287
}

0 commit comments

Comments
 (0)