Skip to content

Commit

Permalink
order+account: account for new dust limit w/ smaller acct in test
Browse files Browse the repository at this point in the history
For the batch verify test, the dust limit is now smaller by 160
satoshis, so we reduce the main account by this amount in order to
commit a minimal diff, rather than overhaul the test to be more robust.
  • Loading branch information
Roasbeef committed Oct 6, 2021
1 parent d9b62a4 commit 28626e3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions account/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,19 +470,19 @@ func (o *OutputWithFee) CloseOutputs(accountValue btcutil.Amount,
case txscript.WitnessV0PubKeyHashTy:
weightEstimator.AddP2WKHOutput()
dustLimit = lnwallet.DustLimitForSize(
input.P2WKHOutputSize,
input.P2WPKHSize,
)

case txscript.ScriptHashTy:
weightEstimator.AddP2SHOutput()
dustLimit = lnwallet.DustLimitForSize(
input.P2SHOutputSize,
input.P2SHSize,
)

case txscript.WitnessV0ScriptHashTy:
weightEstimator.AddP2WSHOutput()
dustLimit = lnwallet.DustLimitForSize(
input.P2WSHOutputSize,
input.P2WSHSize,
)
}

Expand Down
2 changes: 1 addition & 1 deletion order/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (d *AccountDiff) validateEndingState(tx *wire.MsgTx,

state := d.EndingState
wrongStateErr := fmt.Errorf(
"unexpected state %d for ending balance %d", state,
"unexpected state %v for ending balance %d", state,
d.EndingBalance,
)

Expand Down
4 changes: 2 additions & 2 deletions order/batch_verifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ func TestBatchVerifier(t *testing.T) {
TraderKey: &keychain.KeyDescriptor{
PubKey: acctKeySmall,
},
Value: 401_000,
Value: 400_840,
Expiry: 144,
State: account.StateOpen,
BatchKey: startBatchKey,
Expand Down Expand Up @@ -455,7 +455,7 @@ func TestBatchVerifier(t *testing.T) {
AccountKey: acctKeySmall,
EndingState: stateExtendedOffchain,
OutpointIndex: -1,
EndingBalance: 594,
EndingBalance: 434,
},
}
matchedOrders := map[Nonce][]*MatchedOrder{
Expand Down

0 comments on commit 28626e3

Please sign in to comment.