Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
fix(BUX-461): default fee
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-4chain authored and dorzepowski committed Jan 12, 2024
1 parent 4f681e1 commit 2ebc639
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 13 deletions.
2 changes: 1 addition & 1 deletion chainstate/definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const (
func DefaultFee() *utils.FeeUnit {
return &utils.FeeUnit{
Satoshis: 1,
Bytes: 20,
Bytes: 1000,
}
}

Expand Down
2 changes: 2 additions & 0 deletions go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 26 additions & 12 deletions utils/fees_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,30 @@ func TestGetOutputSizeForType(t *testing.T) {
}

func TestIsLowerThan(t *testing.T) {
one := FeeUnit{
Satoshis: 1,
Bytes: 20,
}
two := FeeUnit{
Satoshis: 2,
Bytes: 20,
}
assert.True(t, one.IsLowerThan(&two))
assert.False(t, two.IsLowerThan(&one))
t.Run("same satoshis, different bytes", func(t *testing.T) {
one := FeeUnit{
Satoshis: 1,
Bytes: 1000,
}
two := FeeUnit{
Satoshis: 1,
Bytes: 20,
}
assert.True(t, one.IsLowerThan(&two))
assert.False(t, two.IsLowerThan(&one))
})
t.Run("same bytes, different satoshis", func(t *testing.T) {
one := FeeUnit{
Satoshis: 1,
Bytes: 20,
}
two := FeeUnit{
Satoshis: 2,
Bytes: 20,
}
assert.True(t, one.IsLowerThan(&two))
assert.False(t, two.IsLowerThan(&one))
})
}

func TestLowestFee(t *testing.T) {
Expand Down Expand Up @@ -87,8 +101,8 @@ func TestLowestFee(t *testing.T) {
})

t.Run("lowest fee as defaultValue", func(t *testing.T) {
feeList, defaultFee := initTest()
feeList = []FeeUnit{}
_, defaultFee := initTest()
feeList := []FeeUnit{}
assert.Equal(t, defaultFee, *LowestFee(feeList, &defaultFee))
})
}

0 comments on commit 2ebc639

Please sign in to comment.