Skip to content

Commit a4775b4

Browse files
committed
itest: remove redundant logAndPublish in favor of LogAndPublish
Replaces previous use cases of logAndPublish with the unified LogAndPublish function to reduce redundancy.
1 parent 602feaf commit a4775b4

File tree

1 file changed

+1
-40
lines changed

1 file changed

+1
-40
lines changed

itest/psbt_test.go

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2438,7 +2438,7 @@ func testPsbtTrustlessSwap(t *harnessTest) {
24382438
signedPkt := finalizePacket(t.t, lndBob, finalPsbt)
24392439
require.True(t.t, signedPkt.IsComplete())
24402440

2441-
logResp := logAndPublish(
2441+
logResp := LogAndPublish(
24422442
t.t, alice, signedPkt, []*tappsbt.VPacket{bobVPsbt}, nil, resp,
24432443
)
24442444
t.Logf("Logged transaction: %v", toJSON(t.t, logResp))
@@ -3424,45 +3424,6 @@ func finalizePacket(t *testing.T, lnd *node.HarnessNode,
34243424
return signedPacket
34253425
}
34263426

3427-
func logAndPublish(t *testing.T, tapd *tapdHarness, btcPkt *psbt.Packet,
3428-
activeAssets []*tappsbt.VPacket, passiveAssets []*tappsbt.VPacket,
3429-
commitResp *wrpc.CommitVirtualPsbtsResponse) *taprpc.SendAssetResponse {
3430-
3431-
ctxb := context.Background()
3432-
ctxt, cancel := context.WithTimeout(ctxb, defaultWaitTimeout)
3433-
defer cancel()
3434-
3435-
var buf bytes.Buffer
3436-
err := btcPkt.Serialize(&buf)
3437-
require.NoError(t, err)
3438-
3439-
request := &wrpc.PublishAndLogRequest{
3440-
AnchorPsbt: buf.Bytes(),
3441-
VirtualPsbts: make([][]byte, len(activeAssets)),
3442-
PassiveAssetPsbts: make([][]byte, len(passiveAssets)),
3443-
ChangeOutputIndex: commitResp.ChangeOutputIndex,
3444-
LndLockedUtxos: commitResp.LndLockedUtxos,
3445-
}
3446-
3447-
for idx := range activeAssets {
3448-
request.VirtualPsbts[idx], err = tappsbt.Encode(
3449-
activeAssets[idx],
3450-
)
3451-
require.NoError(t, err)
3452-
}
3453-
for idx := range passiveAssets {
3454-
request.PassiveAssetPsbts[idx], err = tappsbt.Encode(
3455-
passiveAssets[idx],
3456-
)
3457-
require.NoError(t, err)
3458-
}
3459-
3460-
resp, err := tapd.PublishAndLogTransfer(ctxt, request)
3461-
require.NoError(t, err)
3462-
3463-
return resp
3464-
}
3465-
34663427
// getAddressBip32Derivation returns the PSBT BIP-0032 derivation info of an
34673428
// address.
34683429
func getAddressBip32Derivation(t testing.TB, addr string,

0 commit comments

Comments
 (0)