* Cleanup common

* Cleanup client

* Cleanup server

* Renamings

* Tidy up proto

* Update ocean protos

* Fixes

* Fixes
This commit is contained in:
Pietralberto Mazza
2024-02-28 18:05:03 +01:00
committed by GitHub
parent 1650ea5935
commit 6d0d03e316
31 changed files with 2475 additions and 2217 deletions

View File

@@ -20,10 +20,10 @@ import (
)
const (
testingKey = "0218d5ca8b58797b7dbd65c075dd7ba7784b3f38ab71b1a5a8e3f94ba0257654a6"
minRelayFee = uint64(30)
roundLifetime = int64(1209344)
exitDelay = int64(512)
testingKey = "0218d5ca8b58797b7dbd65c075dd7ba7784b3f38ab71b1a5a8e3f94ba0257654a6"
minRelayFee = uint64(30)
roundLifetime = int64(1209344)
unilateralExitDelay = int64(512)
)
var (
@@ -45,7 +45,9 @@ func TestMain(m *testing.M) {
}
func TestBuildPoolTx(t *testing.T) {
builder := txbuilder.NewTxBuilder(wallet, network.Liquid, roundLifetime, exitDelay)
builder := txbuilder.NewTxBuilder(
wallet, network.Liquid, roundLifetime, unilateralExitDelay,
)
fixtures, err := parsePoolTxFixtures()
require.NoError(t, err)
@@ -54,14 +56,18 @@ func TestBuildPoolTx(t *testing.T) {
if len(fixtures.Valid) > 0 {
t.Run("valid", func(t *testing.T) {
for _, f := range fixtures.Valid {
poolTx, congestionTree, err := builder.BuildPoolTx(pubkey, f.Payments, minRelayFee)
poolTx, congestionTree, err := builder.BuildPoolTx(
pubkey, f.Payments, minRelayFee,
)
require.NoError(t, err)
require.NotEmpty(t, poolTx)
require.NotEmpty(t, congestionTree)
require.Equal(t, f.ExpectedNumOfNodes, congestionTree.NumberOfNodes())
require.Len(t, congestionTree.Leaves(), f.ExpectedNumOfLeaves)
err = tree.ValidateCongestionTree(congestionTree, poolTx, pubkey, roundLifetime)
err = tree.ValidateCongestionTree(
congestionTree, poolTx, pubkey, roundLifetime,
)
require.NoError(t, err)
}
})
@@ -70,7 +76,9 @@ func TestBuildPoolTx(t *testing.T) {
if len(fixtures.Invalid) > 0 {
t.Run("invalid", func(t *testing.T) {
for _, f := range fixtures.Invalid {
poolTx, congestionTree, err := builder.BuildPoolTx(pubkey, f.Payments, minRelayFee)
poolTx, congestionTree, err := builder.BuildPoolTx(
pubkey, f.Payments, minRelayFee,
)
require.EqualError(t, err, f.ExpectedErr)
require.Empty(t, poolTx)
require.Empty(t, congestionTree)
@@ -80,7 +88,9 @@ func TestBuildPoolTx(t *testing.T) {
}
func TestBuildForfeitTxs(t *testing.T) {
builder := txbuilder.NewTxBuilder(wallet, network.Liquid, 1209344, exitDelay)
builder := txbuilder.NewTxBuilder(
wallet, network.Liquid, 1209344, unilateralExitDelay,
)
fixtures, err := parseForfeitTxsFixtures()
require.NoError(t, err)