Skip to content

Commit 62d13e9

Browse files
[Backport] Optimize deposit sweep proposal generator (#3808)
This pull request backports #3805 to the `releases/mainnet/v2.0.1` branch.
2 parents f958ba0 + ff963f9 commit 62d13e9

File tree

2 files changed

+2
-19
lines changed

2 files changed

+2
-19
lines changed

cmd/maintainercli.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,12 @@ var listDepositsCommand = cobra.Command{
132132

133133
func printDepositsTable(deposits []*tbtcpg.Deposit) error {
134134
w := tabwriter.NewWriter(os.Stdout, 2, 4, 1, ' ', tabwriter.AlignRight)
135-
fmt.Fprintf(w, "index\twallet\ttype\tvalue (BTC)\tdeposit key\trevealed deposit data\tconfirmations\tswept\t\n")
135+
fmt.Fprintf(w, "index\twallet\tvalue (BTC)\tdeposit key\trevealed deposit data\tconfirmations\tswept\t\n")
136136

137137
for i, deposit := range deposits {
138-
fmt.Fprintf(w, "%d\t%s\t%s\t%.5f\t%s\t%s\t%d\t%t\t\n",
138+
fmt.Fprintf(w, "%d\t%s\t%.5f\t%s\t%s\t%d\t%t\t\n",
139139
i,
140140
hexutils.Encode(deposit.WalletPublicKeyHash[:]),
141-
deposit.ScriptType,
142141
deposit.AmountBtc,
143142
deposit.DepositKey,
144143
fmt.Sprintf(

pkg/tbtcpg/deposit_sweep.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ type Deposit struct {
104104
DepositReference
105105

106106
WalletPublicKeyHash [20]byte
107-
ScriptType bitcoin.ScriptType
108107
DepositKey string
109108
IsSwept bool
110109
AmountBtc float64
@@ -241,20 +240,6 @@ func findDeposits(
241240
continue
242241
}
243242

244-
var scriptType bitcoin.ScriptType
245-
depositTransaction, err := btcChain.GetTransaction(
246-
event.FundingTxHash,
247-
)
248-
if err != nil {
249-
fnLogger.Errorf(
250-
"failed to get deposit transaction data: [%v]",
251-
err,
252-
)
253-
} else {
254-
publicKeyScript := depositTransaction.Outputs[event.FundingOutputIndex].PublicKeyScript
255-
scriptType = bitcoin.GetScriptType(publicKeyScript)
256-
}
257-
258243
result = append(
259244
result,
260245
&Deposit{
@@ -264,7 +249,6 @@ func findDeposits(
264249
RevealBlock: event.BlockNumber,
265250
},
266251
WalletPublicKeyHash: event.WalletPublicKeyHash,
267-
ScriptType: scriptType,
268252
DepositKey: hexutils.Encode(depositKey.Bytes()),
269253
IsSwept: isSwept,
270254
AmountBtc: convertSatToBtc(float64(depositRequest.Amount)),

0 commit comments

Comments
 (0)