Skip to content

Commit 6c88798

Browse files
committed
tapfreighter: rename state SendStateLogCommit
Renamed the `ChainPorter` state `SendStateLogCommit` to `SendStateStorePreBroadcast` for better clarity on the state's functionality
1 parent d70bccd commit 6c88798

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

itest/psbt_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2968,7 +2968,7 @@ func testPsbtRelativeLockTimeSendProofFail(t *harnessTest) {
29682968

29692969
AssertSendEvents(
29702970
t.t, aliceScriptKeyBytes, sendEvents,
2971-
tapfreighter.SendStateLogCommit,
2971+
tapfreighter.SendStateStorePreBroadcast,
29722972
tapfreighter.SendStateWaitTxConf,
29732973
)
29742974

tapfreighter/chain_porter.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,16 +1031,16 @@ func (p *ChainPorter) stateStep(currentPkg sendPackage) (*sendPackage, error) {
10311031
"package: %w", err)
10321032
}
10331033

1034-
currentPkg.SendState = SendStateLogCommit
1034+
currentPkg.SendState = SendStateStorePreBroadcast
10351035

10361036
return &currentPkg, nil
10371037

1038-
// At this state, we have a final PSBT transaction which is fully
1039-
// signed. We'll write this to disk (the point of no return), then
1040-
// broadcast this to the network.
1041-
case SendStateLogCommit:
1042-
// Before we can broadcast, we want to find out the current
1043-
// height to pass as a height hint.
1038+
// In this state, the parcel state is stored before the fully signed
1039+
// transaction is broadcast to the mempool.
1040+
case SendStateStorePreBroadcast:
1041+
// We won't broadcast in this state, but in preparation for
1042+
// broadcasting, we will find out the current height to use as
1043+
// a height hint.
10441044
ctx, cancel := p.WithCtxQuit()
10451045
defer cancel()
10461046
currentHeight, err := p.cfg.ChainBridge.CurrentHeight(ctx)

tapfreighter/parcel.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,9 @@ const (
3838
// then finalize to place the necessary signatures in the transaction.
3939
SendStateAnchorSign
4040

41-
// SendStateLogCommit is the final in memory state. In this state,
42-
// we'll extract the signed transaction from the PSBT and log the
43-
// transfer information to disk. At this point, after a restart, the
44-
// transfer can be resumed.
45-
SendStateLogCommit
41+
// SendStateStorePreBroadcast is the state in which the finalized fully
42+
// signed transaction is written to persistent storage before broadcast.
43+
SendStateStorePreBroadcast
4644

4745
// SendStateBroadcast broadcasts the transfer transaction to the
4846
// network, and imports the taproot output back into the wallet to
@@ -78,8 +76,8 @@ func (s SendState) String() string {
7876
case SendStateAnchorSign:
7977
return "SendStateAnchorSign"
8078

81-
case SendStateLogCommit:
82-
return "SendStateLogCommit"
79+
case SendStateStorePreBroadcast:
80+
return "SendStateStorePreBroadcast"
8381

8482
case SendStateBroadcast:
8583
return "SendStateBroadcast"
@@ -381,7 +379,7 @@ func (p *PreAnchoredParcel) pkg() *sendPackage {
381379
// commitment.
382380
return &sendPackage{
383381
Parcel: p,
384-
SendState: SendStateLogCommit,
382+
SendState: SendStateStorePreBroadcast,
385383
VirtualPackets: p.virtualPackets,
386384
PassiveAssets: p.passiveAssets,
387385
AnchorTx: p.anchorTx,

0 commit comments

Comments
 (0)