mirror of
https://github.com/aljazceru/ark.git
synced 2025-12-18 12:44:19 +01:00
Vars and fields renaming (#387)
* Rename asp > server * Rename pool > round * Consolidate naming for pubkey/prvkey vars and types * Fix * Fix * Fix wasm * Rename congestionTree > vtxoTree * Fix wasm * Rename payment > request * Rename congestionTree > vtxoTree after syncing with master * Fix Send API in SDK * Fix wasm * Fix wasm * Fixes * Fixes after review * Fix * Fix naming * Fix * Fix e2e tests
This commit is contained in:
committed by
GitHub
parent
12d666bfdf
commit
7f937e8418
@@ -26,7 +26,7 @@ const (
|
||||
pubkey2 = "33ffb3dee353b1a9ebe4ced64b946238d0a4ac364f275d771da6ad2445d07ae0"
|
||||
)
|
||||
|
||||
var congestionTree = [][]tree.Node{
|
||||
var vtxoTree = [][]tree.Node{
|
||||
{
|
||||
{
|
||||
Txid: randomString(32),
|
||||
@@ -148,17 +148,17 @@ func testRoundEventRepository(t *testing.T, svc ports.RepoManager) {
|
||||
Timestamp: 1701190270,
|
||||
},
|
||||
domain.RoundFinalizationStarted{
|
||||
Id: "1ea610ff-bf3e-4068-9bfd-b6c3f553467e",
|
||||
CongestionTree: congestionTree,
|
||||
Connectors: []string{emptyPtx, emptyPtx},
|
||||
RoundTx: emptyTx,
|
||||
Id: "1ea610ff-bf3e-4068-9bfd-b6c3f553467e",
|
||||
VtxoTree: vtxoTree,
|
||||
Connectors: []string{emptyPtx, emptyPtx},
|
||||
RoundTx: emptyTx,
|
||||
},
|
||||
},
|
||||
handler: func(round *domain.Round) {
|
||||
require.NotNil(t, round)
|
||||
require.Len(t, round.Events(), 2)
|
||||
require.Len(t, round.CongestionTree, 3)
|
||||
require.Equal(t, round.CongestionTree.NumberOfNodes(), 7)
|
||||
require.Len(t, round.VtxoTree, 3)
|
||||
require.Equal(t, round.VtxoTree.NumberOfNodes(), 7)
|
||||
require.Len(t, round.Connectors, 2)
|
||||
},
|
||||
},
|
||||
@@ -170,10 +170,10 @@ func testRoundEventRepository(t *testing.T, svc ports.RepoManager) {
|
||||
Timestamp: 1701190270,
|
||||
},
|
||||
domain.RoundFinalizationStarted{
|
||||
Id: "7578231e-428d-45ae-aaa4-e62c77ad5cec",
|
||||
CongestionTree: congestionTree,
|
||||
Connectors: []string{emptyPtx, emptyPtx},
|
||||
RoundTx: emptyTx,
|
||||
Id: "7578231e-428d-45ae-aaa4-e62c77ad5cec",
|
||||
VtxoTree: vtxoTree,
|
||||
Connectors: []string{emptyPtx, emptyPtx},
|
||||
RoundTx: emptyTx,
|
||||
},
|
||||
domain.RoundFinalized{
|
||||
Id: "7578231e-428d-45ae-aaa4-e62c77ad5cec",
|
||||
@@ -237,9 +237,9 @@ func testRoundRepository(t *testing.T, svc ports.RepoManager) {
|
||||
require.Condition(t, roundsMatch(*round, *roundById))
|
||||
|
||||
newEvents := []domain.RoundEvent{
|
||||
domain.PaymentsRegistered{
|
||||
domain.TxRequestsRegistered{
|
||||
Id: roundId,
|
||||
Payments: []domain.Payment{
|
||||
TxRequests: []domain.TxRequest{
|
||||
{
|
||||
Id: uuid.New().String(),
|
||||
Inputs: []domain.Vtxo{
|
||||
@@ -250,12 +250,12 @@ func testRoundRepository(t *testing.T, svc ports.RepoManager) {
|
||||
},
|
||||
RoundTxid: randomString(32),
|
||||
ExpireAt: 7980322,
|
||||
Pubkey: randomString(32),
|
||||
PubKey: randomString(32),
|
||||
Amount: 300,
|
||||
},
|
||||
},
|
||||
Receivers: []domain.Receiver{{
|
||||
Pubkey: randomString(32),
|
||||
PubKey: randomString(32),
|
||||
Amount: 300,
|
||||
}},
|
||||
},
|
||||
@@ -270,17 +270,17 @@ func testRoundRepository(t *testing.T, svc ports.RepoManager) {
|
||||
},
|
||||
RoundTxid: randomString(32),
|
||||
ExpireAt: 7980322,
|
||||
Pubkey: randomString(32),
|
||||
PubKey: randomString(32),
|
||||
Amount: 600,
|
||||
},
|
||||
},
|
||||
Receivers: []domain.Receiver{
|
||||
{
|
||||
Pubkey: randomString(32),
|
||||
PubKey: randomString(32),
|
||||
Amount: 400,
|
||||
},
|
||||
{
|
||||
Pubkey: randomString(32),
|
||||
PubKey: randomString(32),
|
||||
Amount: 200,
|
||||
},
|
||||
},
|
||||
@@ -288,16 +288,16 @@ func testRoundRepository(t *testing.T, svc ports.RepoManager) {
|
||||
},
|
||||
},
|
||||
domain.RoundFinalizationStarted{
|
||||
Id: roundId,
|
||||
CongestionTree: congestionTree,
|
||||
Connectors: []string{emptyPtx, emptyPtx},
|
||||
RoundTx: emptyTx,
|
||||
Id: roundId,
|
||||
VtxoTree: vtxoTree,
|
||||
Connectors: []string{emptyPtx, emptyPtx},
|
||||
RoundTx: emptyTx,
|
||||
},
|
||||
}
|
||||
events = append(events, newEvents...)
|
||||
updatedRound := domain.NewRoundFromEvents(events)
|
||||
for _, pay := range updatedRound.Payments {
|
||||
err = svc.Vtxos().AddVtxos(ctx, pay.Inputs)
|
||||
for _, request := range updatedRound.TxRequests {
|
||||
err = svc.Vtxos().AddVtxos(ctx, request.Inputs)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
@@ -346,7 +346,7 @@ func testVtxoRepository(t *testing.T, svc ports.RepoManager) {
|
||||
Txid: randomString(32),
|
||||
VOut: 0,
|
||||
},
|
||||
Pubkey: pubkey,
|
||||
PubKey: pubkey,
|
||||
Amount: 1000,
|
||||
},
|
||||
{
|
||||
@@ -354,7 +354,7 @@ func testVtxoRepository(t *testing.T, svc ports.RepoManager) {
|
||||
Txid: randomString(32),
|
||||
VOut: 1,
|
||||
},
|
||||
Pubkey: pubkey,
|
||||
PubKey: pubkey,
|
||||
Amount: 2000,
|
||||
},
|
||||
}
|
||||
@@ -363,7 +363,7 @@ func testVtxoRepository(t *testing.T, svc ports.RepoManager) {
|
||||
Txid: randomString(32),
|
||||
VOut: 1,
|
||||
},
|
||||
Pubkey: pubkey2,
|
||||
PubKey: pubkey2,
|
||||
Amount: 2000,
|
||||
})
|
||||
|
||||
@@ -567,8 +567,8 @@ func roundsMatch(expected, got domain.Round) assert.Comparison {
|
||||
return false
|
||||
}
|
||||
|
||||
for k, v := range expected.Payments {
|
||||
gotValue, ok := got.Payments[k]
|
||||
for k, v := range expected.TxRequests {
|
||||
gotValue, ok := got.TxRequests[k]
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
@@ -612,7 +612,7 @@ func roundsMatch(expected, got domain.Round) assert.Comparison {
|
||||
}
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(expected.CongestionTree, got.CongestionTree) {
|
||||
if !reflect.DeepEqual(expected.VtxoTree, got.VtxoTree) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user