From 84ee1a155b381fb7427244233679213a8000be7c Mon Sep 17 00:00:00 2001 From: Nate Maninger Date: Tue, 29 Oct 2024 15:56:30 -0700 Subject: [PATCH 1/4] syncer: raise default max inbound peers --- syncer/syncer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syncer/syncer.go b/syncer/syncer.go index ed2667e..83f9f64 100644 --- a/syncer/syncer.go +++ b/syncer/syncer.go @@ -764,7 +764,7 @@ func (s *Syncer) Addr() string { // New returns a new Syncer. func New(l net.Listener, cm ChainManager, pm PeerStore, header gateway.Header, opts ...Option) *Syncer { config := config{ - MaxInboundPeers: 16, + MaxInboundPeers: 64, MaxOutboundPeers: 16, MaxInflightRPCs: 3, ConnectTimeout: 5 * time.Second, From b338b7340d47ab27990527976b7ad437a41148a2 Mon Sep 17 00:00:00 2001 From: Nate Maninger Date: Tue, 29 Oct 2024 15:56:36 -0700 Subject: [PATCH 2/4] deps: update core --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d538e6b..9dd4047 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ toolchain go1.23.2 require ( go.etcd.io/bbolt v1.3.11 - go.sia.tech/core v0.5.1-0.20241028200253-79ba0d10d81a + go.sia.tech/core v0.6.1 go.sia.tech/mux v1.3.0 go.uber.org/zap v1.27.0 golang.org/x/crypto v0.28.0 diff --git a/go.sum b/go.sum index c3a1430..9d53a04 100644 --- a/go.sum +++ b/go.sum @@ -6,8 +6,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= go.etcd.io/bbolt v1.3.11 h1:yGEzV1wPz2yVCLsD8ZAiGHhHVlczyC9d1rP43/VCRJ0= go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I= -go.sia.tech/core v0.5.1-0.20241028200253-79ba0d10d81a h1:XvbHRJczUk4ZqKcivdxxf4UoJNSi42Ee0uXTNaEROgQ= -go.sia.tech/core v0.5.1-0.20241028200253-79ba0d10d81a/go.mod h1:P3C1BWa/7J4XgdzWuaYHBvLo2RzZ0UBaJM4TG1GWB2g= +go.sia.tech/core v0.6.1 h1:eaExM2E2eNr43su2XDkY5J24E3F54YGS7hcC3WtVjVk= +go.sia.tech/core v0.6.1/go.mod h1:P3C1BWa/7J4XgdzWuaYHBvLo2RzZ0UBaJM4TG1GWB2g= go.sia.tech/mux v1.3.0 h1:hgR34IEkqvfBKUJkAzGi31OADeW2y7D6Bmy/Jcbop9c= go.sia.tech/mux v1.3.0/go.mod h1:I46++RD4beqA3cW9Xm9SwXbezwPqLvHhVs9HLpDtt58= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= From c2ba31c8165257219325954d381a6649fdb31b13 Mon Sep 17 00:00:00 2001 From: Nate Maninger Date: Tue, 29 Oct 2024 15:57:31 -0700 Subject: [PATCH 3/4] all: update state element --- chain/chain_test.go | 4 +- chain/db.go | 12 ++--- chain/manager.go | 66 ++++++++++++------------ miner_test.go | 2 +- rhp/v4/rpc.go | 18 +++---- testutil/wallet.go | 17 +++--- wallet/events.go | 123 ++++++++++++++++++++++++++++++++++++++++++++ wallet/update.go | 40 +++++--------- wallet/wallet.go | 68 ++++++++++++------------ 9 files changed, 226 insertions(+), 124 deletions(-) diff --git a/chain/chain_test.go b/chain/chain_test.go index 8f2ac16..d4611ce 100644 --- a/chain/chain_test.go +++ b/chain/chain_test.go @@ -13,7 +13,7 @@ import ( type memState struct { index types.ChainIndex - utxos map[types.Hash256]types.SiacoinElement + utxos map[types.SiacoinOutputID]types.SiacoinElement chainIndexElements []types.ChainIndexElement } @@ -109,7 +109,7 @@ func (ms *memState) SpendableElement(t *testing.T) (se types.SiacoinElement) { func newMemState() *memState { return &memState{ - utxos: make(map[types.Hash256]types.SiacoinElement), + utxos: make(map[types.SiacoinOutputID]types.SiacoinElement), } } diff --git a/chain/db.go b/chain/db.go index bffec8f..9f1eda0 100644 --- a/chain/db.go +++ b/chain/db.go @@ -352,13 +352,13 @@ func (db *DBStore) getElementProof(leafIndex, numLeaves uint64) (proof []types.H func (db *DBStore) getSiacoinElement(id types.SiacoinOutputID, numLeaves uint64) (sce types.SiacoinElement, ok bool) { ok = db.bucket(bSiacoinElements).get(id[:], &sce) if ok { - sce.MerkleProof = db.getElementProof(sce.LeafIndex, numLeaves) + sce.StateElement.MerkleProof = db.getElementProof(sce.StateElement.LeafIndex, numLeaves) } return } func (db *DBStore) putSiacoinElement(sce types.SiacoinElement) { - sce.MerkleProof = nil + sce.StateElement.MerkleProof = nil db.bucket(bSiacoinElements).put(sce.ID[:], sce) } @@ -369,13 +369,13 @@ func (db *DBStore) deleteSiacoinElement(id types.SiacoinOutputID) { func (db *DBStore) getSiafundElement(id types.SiafundOutputID, numLeaves uint64) (sfe types.SiafundElement, ok bool) { ok = db.bucket(bSiafundElements).get(id[:], &sfe) if ok { - sfe.MerkleProof = db.getElementProof(sfe.LeafIndex, numLeaves) + sfe.StateElement.MerkleProof = db.getElementProof(sfe.StateElement.LeafIndex, numLeaves) } return } func (db *DBStore) putSiafundElement(sfe types.SiafundElement) { - sfe.MerkleProof = nil + sfe.StateElement.MerkleProof = nil db.bucket(bSiafundElements).put(sfe.ID[:], sfe) } @@ -386,13 +386,13 @@ func (db *DBStore) deleteSiafundElement(id types.SiafundOutputID) { func (db *DBStore) getFileContractElement(id types.FileContractID, numLeaves uint64) (fce types.FileContractElement, ok bool) { ok = db.bucket(bFileContractElements).get(id[:], &fce) if ok { - fce.MerkleProof = db.getElementProof(fce.LeafIndex, numLeaves) + fce.StateElement.MerkleProof = db.getElementProof(fce.StateElement.LeafIndex, numLeaves) } return } func (db *DBStore) putFileContractElement(fce types.FileContractElement) { - fce.MerkleProof = nil + fce.StateElement.MerkleProof = nil db.bucket(bFileContractElements).put(fce.ID[:], fce) } diff --git a/chain/manager.go b/chain/manager.go index 22440f2..d1b6288 100644 --- a/chain/manager.go +++ b/chain/manager.go @@ -667,48 +667,48 @@ func (m *Manager) revertPoolUpdate(cru consensus.RevertUpdate, cs consensus.Stat // applying a block can make ephemeral elements in the txpool non-ephemeral; // here, we undo that var uncreated map[types.Hash256]bool - replaceEphemeral := func(e *types.StateElement) { + replaceEphemeral := func(id types.Hash256, e *types.StateElement) { if e.LeafIndex == types.UnassignedLeafIndex { return } else if uncreated == nil { uncreated = make(map[types.Hash256]bool) cru.ForEachSiacoinElement(func(sce types.SiacoinElement, created, spent bool) { if created { - uncreated[sce.ID] = true + uncreated[types.Hash256(sce.ID)] = true } }) cru.ForEachSiafundElement(func(sfe types.SiafundElement, created, spent bool) { if created { - uncreated[sfe.ID] = true + uncreated[types.Hash256(sfe.ID)] = true } }) cru.ForEachFileContractElement(func(fce types.FileContractElement, created bool, rev *types.FileContractElement, resolved, valid bool) { if created { - uncreated[fce.ID] = true + uncreated[types.Hash256(fce.ID)] = true } }) cru.ForEachV2FileContractElement(func(fce types.V2FileContractElement, created bool, rev *types.V2FileContractElement, res types.V2FileContractResolutionType) { if created { - uncreated[fce.ID] = true + uncreated[types.Hash256(fce.ID)] = true } }) } - if uncreated[e.ID] { - *e = types.StateElement{ID: e.ID, LeafIndex: types.UnassignedLeafIndex} + if uncreated[id] { + *e = types.StateElement{LeafIndex: types.UnassignedLeafIndex} } } for _, txn := range m.txpool.v2txns { - for i := range txn.SiacoinInputs { - replaceEphemeral(&txn.SiacoinInputs[i].Parent.StateElement) + for i, si := range txn.SiacoinInputs { + replaceEphemeral(types.Hash256(si.Parent.ID), &txn.SiacoinInputs[i].Parent.StateElement) } - for i := range txn.SiafundInputs { - replaceEphemeral(&txn.SiafundInputs[i].Parent.StateElement) + for i, si := range txn.SiafundInputs { + replaceEphemeral(types.Hash256(si.Parent.ID), &txn.SiafundInputs[i].Parent.StateElement) } - for i := range txn.FileContractRevisions { - replaceEphemeral(&txn.FileContractRevisions[i].Parent.StateElement) + for i, fcr := range txn.FileContractRevisions { + replaceEphemeral(types.Hash256(fcr.Parent.ID), &txn.FileContractRevisions[i].Parent.StateElement) } - for i := range txn.FileContractResolutions { - replaceEphemeral(&txn.FileContractResolutions[i].Parent.StateElement) + for i, fcr := range txn.FileContractResolutions { + replaceEphemeral(types.Hash256(fcr.Parent.ID), &txn.FileContractResolutions[i].Parent.StateElement) } } @@ -724,48 +724,48 @@ func (m *Manager) revertPoolUpdate(cru consensus.RevertUpdate, cs consensus.Stat func (m *Manager) applyPoolUpdate(cau consensus.ApplyUpdate, cs consensus.State) { // applying a block can make ephemeral elements in the txpool non-ephemeral var newElements map[types.Hash256]types.StateElement - replaceEphemeral := func(e *types.StateElement) { + replaceEphemeral := func(id types.Hash256, e *types.StateElement) { if e.LeafIndex != types.UnassignedLeafIndex { return } else if newElements == nil { newElements = make(map[types.Hash256]types.StateElement) cau.ForEachSiacoinElement(func(sce types.SiacoinElement, created, spent bool) { if created { - newElements[sce.ID] = sce.StateElement + newElements[types.Hash256(sce.ID)] = sce.StateElement } }) cau.ForEachSiafundElement(func(sfe types.SiafundElement, created, spent bool) { if created { - newElements[sfe.ID] = sfe.StateElement + newElements[types.Hash256(sfe.ID)] = sfe.StateElement } }) cau.ForEachFileContractElement(func(fce types.FileContractElement, created bool, rev *types.FileContractElement, resolved, valid bool) { if created { - newElements[fce.ID] = fce.StateElement + newElements[types.Hash256(fce.ID)] = fce.StateElement } }) cau.ForEachV2FileContractElement(func(fce types.V2FileContractElement, created bool, rev *types.V2FileContractElement, res types.V2FileContractResolutionType) { if created { - newElements[fce.ID] = fce.StateElement + newElements[types.Hash256(fce.ID)] = fce.StateElement } }) } - if se, ok := newElements[e.ID]; ok { + if se, ok := newElements[id]; ok { *e = se } } for _, txn := range m.txpool.v2txns { - for i := range txn.SiacoinInputs { - replaceEphemeral(&txn.SiacoinInputs[i].Parent.StateElement) + for i, si := range txn.SiacoinInputs { + replaceEphemeral(types.Hash256(si.Parent.ID), &txn.SiacoinInputs[i].Parent.StateElement) } - for i := range txn.SiafundInputs { - replaceEphemeral(&txn.SiafundInputs[i].Parent.StateElement) + for i, si := range txn.SiafundInputs { + replaceEphemeral(types.Hash256(si.Parent.ID), &txn.SiafundInputs[i].Parent.StateElement) } - for i := range txn.FileContractRevisions { - replaceEphemeral(&txn.FileContractRevisions[i].Parent.StateElement) + for i, fcr := range txn.FileContractRevisions { + replaceEphemeral(types.Hash256(fcr.Parent.ID), &txn.FileContractRevisions[i].Parent.StateElement) } - for i := range txn.FileContractResolutions { - replaceEphemeral(&txn.FileContractResolutions[i].Parent.StateElement) + for i, fcr := range txn.FileContractResolutions { + replaceEphemeral(types.Hash256(fcr.Parent.ID), &txn.FileContractResolutions[i].Parent.StateElement) } } @@ -1082,12 +1082,12 @@ func (m *Manager) updateV2TransactionProofs(txns []types.V2Transaction, from, to confirmedStateElements := make(map[types.Hash256]types.StateElement) cau.ForEachSiacoinElement(func(sce types.SiacoinElement, created, spent bool) { if created { - confirmedStateElements[sce.ID] = sce.StateElement + confirmedStateElements[types.Hash256(sce.ID)] = sce.StateElement } }) cau.ForEachSiafundElement(func(sfe types.SiafundElement, created, spent bool) { if created { - confirmedStateElements[sfe.ID] = sfe.StateElement + confirmedStateElements[types.Hash256(sfe.ID)] = sfe.StateElement } }) @@ -1100,7 +1100,7 @@ func (m *Manager) updateV2TransactionProofs(txns []types.V2Transaction, from, to // update the state elements for any confirmed ephemeral elements for j := range txns[i].SiacoinInputs { - if txns[i].SiacoinInputs[j].Parent.LeafIndex != types.UnassignedLeafIndex { + if txns[i].SiacoinInputs[j].Parent.StateElement.LeafIndex != types.UnassignedLeafIndex { continue } se, ok := confirmedStateElements[types.Hash256(txns[i].SiacoinInputs[j].Parent.ID)] @@ -1112,7 +1112,7 @@ func (m *Manager) updateV2TransactionProofs(txns []types.V2Transaction, from, to // update the state elements for any confirmed ephemeral elements for j := range txns[i].SiafundInputs { - if txns[i].SiafundInputs[j].Parent.LeafIndex != types.UnassignedLeafIndex { + if txns[i].SiafundInputs[j].Parent.StateElement.LeafIndex != types.UnassignedLeafIndex { continue } se, ok := confirmedStateElements[types.Hash256(txns[i].SiafundInputs[j].Parent.ID)] diff --git a/miner_test.go b/miner_test.go index 8f5b47c..8894958 100644 --- a/miner_test.go +++ b/miner_test.go @@ -105,7 +105,7 @@ func TestV2MineBlocks(t *testing.T) { // mine until just before the allow height mineBlocks(t, 4) - elements := make(map[types.Hash256]types.SiacoinElement) + elements := make(map[types.SiacoinOutputID]types.SiacoinElement) _, applied, err := cm.UpdatesSince(types.ChainIndex{}, 500) if err != nil { t.Fatal(err) diff --git a/rhp/v4/rpc.go b/rhp/v4/rpc.go index 740d206..93d5973 100644 --- a/rhp/v4/rpc.go +++ b/rhp/v4/rpc.go @@ -659,12 +659,9 @@ func RPCRenewContract(ctx context.Context, t TransportClient, tp TxPool, signer FileContractResolutions: []types.V2FileContractResolution{ { Parent: types.V2FileContractElement{ - StateElement: types.StateElement{ - // the other parts of the state element are not required - // for signing the transaction. Let the host fill them - // in. - ID: types.Hash256(params.ContractID), - }, + ID: params.ContractID, + // the state element field is not required for signing the + // transaction. The host will fill it in. }, Resolution: &renewal, }, @@ -787,12 +784,9 @@ func RPCRefreshContract(ctx context.Context, t TransportClient, tp TxPool, signe FileContractResolutions: []types.V2FileContractResolution{ { Parent: types.V2FileContractElement{ - StateElement: types.StateElement{ - // the other parts of the state element are not required - // for signing the transaction. Let the host fill them - // in. - ID: types.Hash256(params.ContractID), - }, + ID: params.ContractID, + // the state element field is not required for signing the + // transaction. The host will fill it in. }, Resolution: &renewal, }, diff --git a/testutil/wallet.go b/testutil/wallet.go index 11cb385..e5f6094 100644 --- a/testutil/wallet.go +++ b/testutil/wallet.go @@ -33,14 +33,13 @@ func (et *ephemeralWalletUpdateTxn) WalletStateElements() (elements []types.Stat return } -func (et *ephemeralWalletUpdateTxn) UpdateWalletStateElements(elements []types.StateElement) error { - for _, se := range elements { - utxo, ok := et.store.utxos[types.SiacoinOutputID(se.ID)] - if !ok { - panic(fmt.Sprintf("siacoin element %q does not exist", se.ID)) - } - utxo.StateElement = se - et.store.utxos[types.SiacoinOutputID(se.ID)] = utxo +// UpdateWalletSiacoinElementProofs updates the proofs of all state elements +// affected by the update. ProofUpdater.UpdateElementProof must be called +// for each state element in the database. +func (et *ephemeralWalletUpdateTxn) UpdateWalletSiacoinElementProofs(pu wallet.ProofUpdater) error { + for _, se := range et.store.utxos { + pu.UpdateElementProof(&se.StateElement) + et.store.utxos[se.ID] = se } return nil } @@ -131,7 +130,7 @@ func (es *EphemeralWalletStore) UnspentSiacoinElements() (utxos []types.SiacoinE defer es.mu.Unlock() for _, se := range es.utxos { - se.MerkleProof = append([]types.Hash256(nil), se.MerkleProof...) + se.StateElement.MerkleProof = append([]types.Hash256(nil), se.StateElement.MerkleProof...) utxos = append(utxos, se) } return utxos, nil diff --git a/wallet/events.go b/wallet/events.go index 3ad5579..9116bd5 100644 --- a/wallet/events.go +++ b/wallet/events.go @@ -276,3 +276,126 @@ func (e *Event) UnmarshalJSON(b []byte) error { } return err } + +// EncodeTo implements types.EncoderTo +func (ep EventPayout) EncodeTo(e *types.Encoder) { + ep.SiacoinElement.EncodeTo(e) +} + +// DecodeFrom implements types.DecoderFrom +func (ep *EventPayout) DecodeFrom(d *types.Decoder) { + ep.SiacoinElement.DecodeFrom(d) +} + +// EncodeTo implements types.EncoderTo +func (et EventV1Transaction) EncodeTo(e *types.Encoder) { + et.Transaction.EncodeTo(e) + types.EncodeSlice(e, et.SpentSiacoinElements) + types.EncodeSlice(e, et.SpentSiafundElements) +} + +// DecodeFrom implements types.DecoderFrom +func (et *EventV1Transaction) DecodeFrom(d *types.Decoder) { + et.Transaction.DecodeFrom(d) + types.DecodeSlice(d, &et.SpentSiacoinElements) + types.DecodeSlice(d, &et.SpentSiafundElements) +} + +// EncodeTo implements types.EncoderTo +func (et EventV2Transaction) EncodeTo(e *types.Encoder) { + types.V2Transaction(et).EncodeTo(e) +} + +// DecodeFrom implements types.DecoderFrom +func (et *EventV2Transaction) DecodeFrom(d *types.Decoder) { + (*types.V2Transaction)(et).DecodeFrom(d) +} + +// EncodeTo implements types.EncoderTo +func (er EventV1ContractResolution) EncodeTo(e *types.Encoder) { + er.Parent.EncodeTo(e) + er.SiacoinElement.EncodeTo(e) + e.WriteBool(er.Missed) +} + +// DecodeFrom implements types.DecoderFrom +func (er *EventV1ContractResolution) DecodeFrom(d *types.Decoder) { + er.Parent.DecodeFrom(d) + er.SiacoinElement.DecodeFrom(d) + er.Missed = d.ReadBool() +} + +// EncodeTo implements types.EncoderTo +func (er EventV2ContractResolution) EncodeTo(e *types.Encoder) { + er.Resolution.EncodeTo(e) + er.SiacoinElement.EncodeTo(e) + e.WriteBool(er.Missed) +} + +// DecodeFrom implements types.DecoderFrom +func (er *EventV2ContractResolution) DecodeFrom(d *types.Decoder) { + er.Resolution.DecodeFrom(d) + er.SiacoinElement.DecodeFrom(d) + er.Missed = d.ReadBool() +} + +// EncodeTo implements types.EncoderTo +func (ev *Event) EncodeTo(e *types.Encoder) { + ev.ID.EncodeTo(e) + ev.Index.EncodeTo(e) + e.WriteUint64(ev.Confirmations) + e.WriteString(ev.Type) + switch data := ev.Data.(type) { + case EventPayout: + data.EncodeTo(e) + case EventV1Transaction: + data.EncodeTo(e) + case EventV1ContractResolution: + data.EncodeTo(e) + case EventV2ContractResolution: + data.EncodeTo(e) + case EventV2Transaction: + types.V2Transaction(data).EncodeTo(e) + default: + panic("unknown event type") // should never happen + } + e.WriteUint64(ev.MaturityHeight) + e.WriteTime(ev.Timestamp) + types.EncodeSlice(e, ev.Relevant) +} + +// DecodeFrom implements types.DecoderFrom +func (ev *Event) DecodeFrom(d *types.Decoder) { + ev.ID.DecodeFrom(d) + ev.Index.DecodeFrom(d) + ev.Confirmations = d.ReadUint64() + ev.Type = d.ReadString() + switch ev.Type { + case EventTypeMinerPayout, EventTypeFoundationSubsidy, EventTypeSiafundClaim: + var data EventPayout + data.DecodeFrom(d) + ev.Data = data + case EventTypeV1Transaction: + var data EventV1Transaction + data.DecodeFrom(d) + ev.Data = data + case EventTypeV1ContractResolution: + var data EventV1ContractResolution + data.DecodeFrom(d) + ev.Data = data + case EventTypeV2ContractResolution: + var data EventV2ContractResolution + data.DecodeFrom(d) + ev.Data = data + case EventTypeV2Transaction: + var data types.V2Transaction + data.DecodeFrom(d) + ev.Data = EventV2Transaction(data) + default: + d.SetErr(fmt.Errorf("unknown event type: %q", ev.Type)) + return + } + ev.MaturityHeight = d.ReadUint64() + ev.Timestamp = d.ReadTime() + types.DecodeSlice(d, &ev.Relevant) +} diff --git a/wallet/update.go b/wallet/update.go index f19b07b..eb474b7 100644 --- a/wallet/update.go +++ b/wallet/update.go @@ -18,15 +18,18 @@ type ( ForEachV2FileContractElement(func(fce types.V2FileContractElement, rev *types.V2FileContractElement, res types.V2FileContractResolutionType)) } + // A ProofUpdater is an interface for updating the proof of a state element. + ProofUpdater interface { + UpdateElementProof(e *types.StateElement) + } + // UpdateTx is an interface for atomically applying chain updates to a // single address wallet. UpdateTx interface { - // WalletStateElements returns all state elements related to the wallet. It is used - // to update the proofs of all state elements affected by the update. - WalletStateElements() ([]types.StateElement, error) - // UpdateWalletStateElements updates the proofs of all state elements affected by the - // update. - UpdateWalletStateElements([]types.StateElement) error + // UpdateWalletSiacoinElementProofs updates the proofs of all state elements + // affected by the update. ProofUpdater.UpdateElementProof must be called + // for each state element in the database. + UpdateWalletSiacoinElementProofs(ProofUpdater) error // WalletApplyIndex is called with the chain index that is being applied. // Any transactions and siacoin elements that were created by the index @@ -89,7 +92,7 @@ func appliedEvents(cau chain.ApplyUpdate, walletAddress types.Address) (events [ // cache the value of siacoin elements to use when calculating v1 outflow cau.ForEachSiacoinElement(func(se types.SiacoinElement, created, spent bool) { - se.MerkleProof = nil // clear the proof to save space + se.StateElement.MerkleProof = nil // clear the proof to save space siacoinElements[types.SiacoinOutputID(se.ID)] = se }) @@ -172,7 +175,7 @@ func appliedEvents(cau chain.ApplyUpdate, walletAddress types.Address) (events [ return } - fce.MerkleProof = nil // clear the proof to save space + fce.StateElement.MerkleProof = nil // clear the proof to save space if valid { for i, so := range fce.FileContract.ValidProofOutputs { @@ -223,7 +226,7 @@ func appliedEvents(cau chain.ApplyUpdate, walletAddress types.Address) (events [ missed = true } - fce.MerkleProof = nil // clear the proof to save space + fce.StateElement.MerkleProof = nil // clear the proof to save space if fce.V2FileContract.HostOutput.Address == walletAddress { outputID := types.FileContractID(fce.ID).V2HostOutputID() @@ -291,15 +294,7 @@ func (sw *SingleAddressWallet) applyChainUpdate(tx UpdateTx, address types.Addre defer sw.mu.Unlock() // update current state elements - stateElements, err := tx.WalletStateElements() - if err != nil { - return fmt.Errorf("failed to get state elements: %w", err) - } - - for i := range stateElements { - cau.UpdateElementProof(&stateElements[i]) - } - if err := tx.UpdateWalletStateElements(stateElements); err != nil { + if err := tx.UpdateWalletSiacoinElementProofs(cau); err != nil { return fmt.Errorf("failed to update state elements: %w", err) } @@ -357,14 +352,7 @@ func (sw *SingleAddressWallet) revertChainUpdate(tx UpdateTx, revertedIndex type } // update the remaining state elements - stateElements, err := tx.WalletStateElements() - if err != nil { - return fmt.Errorf("failed to get state elements: %w", err) - } - for i := range stateElements { - cru.UpdateElementProof(&stateElements[i]) - } - if err := tx.UpdateWalletStateElements(stateElements); err != nil { + if err := tx.UpdateWalletSiacoinElementProofs(cru); err != nil { return fmt.Errorf("failed to update state elements: %w", err) } sw.tip = revertedIndex diff --git a/wallet/wallet.go b/wallet/wallet.go index 33c26be..7f24352 100644 --- a/wallet/wallet.go +++ b/wallet/wallet.go @@ -81,7 +81,7 @@ type ( // locked is a set of siacoin output IDs locked by FundTransaction. They // will be released either by calling Release for unused transactions or // being confirmed in a block. - locked map[types.Hash256]time.Time + locked map[types.SiacoinOutputID]time.Time } ) @@ -116,12 +116,12 @@ func (sw *SingleAddressWallet) Balance() (balance Balance, err error) { return Balance{}, fmt.Errorf("failed to get unspent outputs: %w", err) } - tpoolSpent := make(map[types.Hash256]bool) - tpoolUtxos := make(map[types.Hash256]types.SiacoinElement) + tpoolSpent := make(map[types.SiacoinOutputID]bool) + tpoolUtxos := make(map[types.SiacoinOutputID]types.SiacoinElement) for _, txn := range sw.cm.PoolTransactions() { for _, sci := range txn.SiacoinInputs { - tpoolSpent[types.Hash256(sci.ParentID)] = true - delete(tpoolUtxos, types.Hash256(sci.ParentID)) + tpoolSpent[sci.ParentID] = true + delete(tpoolUtxos, sci.ParentID) } for i, sco := range txn.SiacoinOutputs { if sco.Address != sw.addr { @@ -129,10 +129,9 @@ func (sw *SingleAddressWallet) Balance() (balance Balance, err error) { } outputID := txn.SiacoinOutputID(i) - tpoolUtxos[types.Hash256(outputID)] = types.SiacoinElement{ - StateElement: types.StateElement{ - ID: types.Hash256(types.SiacoinOutputID(outputID)), - }, + tpoolUtxos[outputID] = types.SiacoinElement{ + ID: types.SiacoinOutputID(outputID), + StateElement: types.StateElement{LeafIndex: types.UnassignedLeafIndex}, SiacoinOutput: sco, } } @@ -140,8 +139,8 @@ func (sw *SingleAddressWallet) Balance() (balance Balance, err error) { for _, txn := range sw.cm.V2PoolTransactions() { for _, si := range txn.SiacoinInputs { - tpoolSpent[types.Hash256(si.Parent.ID)] = true - delete(tpoolUtxos, types.Hash256(si.Parent.ID)) + tpoolSpent[si.Parent.ID] = true + delete(tpoolUtxos, si.Parent.ID) } for i, sco := range txn.SiacoinOutputs { if sco.Address != sw.addr { @@ -194,10 +193,10 @@ func (sw *SingleAddressWallet) SpendableOutputs() ([]types.SiacoinElement, error } // fetch outputs currently in the pool - inPool := make(map[types.Hash256]bool) + inPool := make(map[types.SiacoinOutputID]bool) for _, txn := range sw.cm.PoolTransactions() { for _, sci := range txn.SiacoinInputs { - inPool[types.Hash256(sci.ParentID)] = true + inPool[sci.ParentID] = true } } @@ -229,26 +228,25 @@ func (sw *SingleAddressWallet) selectUTXOs(amount types.Currency, inputs int, us return nil, types.ZeroCurrency, err } - tpoolSpent := make(map[types.Hash256]bool) - tpoolUtxos := make(map[types.Hash256]types.SiacoinElement) + tpoolSpent := make(map[types.SiacoinOutputID]bool) + tpoolUtxos := make(map[types.SiacoinOutputID]types.SiacoinElement) for _, txn := range sw.cm.PoolTransactions() { for _, sci := range txn.SiacoinInputs { - tpoolSpent[types.Hash256(sci.ParentID)] = true - delete(tpoolUtxos, types.Hash256(sci.ParentID)) + tpoolSpent[sci.ParentID] = true + delete(tpoolUtxos, sci.ParentID) } for i, sco := range txn.SiacoinOutputs { - tpoolUtxos[types.Hash256(txn.SiacoinOutputID(i))] = types.SiacoinElement{ - StateElement: types.StateElement{ - ID: types.Hash256(types.SiacoinOutputID(txn.SiacoinOutputID(i))), - }, + tpoolUtxos[txn.SiacoinOutputID(i)] = types.SiacoinElement{ + ID: txn.SiacoinOutputID(i), + StateElement: types.StateElement{LeafIndex: types.UnassignedLeafIndex}, SiacoinOutput: sco, } } } for _, txn := range sw.cm.V2PoolTransactions() { for _, sci := range txn.SiacoinInputs { - tpoolSpent[types.Hash256(sci.Parent.ID)] = true - delete(tpoolUtxos, types.Hash256(sci.Parent.ID)) + tpoolSpent[sci.Parent.ID] = true + delete(tpoolUtxos, sci.Parent.ID) } for i := range txn.SiacoinOutputs { sce := txn.EphemeralSiacoinOutput(i) @@ -491,9 +489,9 @@ func (sw *SingleAddressWallet) UnconfirmedEvents() (annotated []Event, err error return nil, fmt.Errorf("failed to get unspent outputs: %w", err) } - utxos := make(map[types.Hash256]types.SiacoinElement) + utxos := make(map[types.SiacoinOutputID]types.SiacoinElement) for _, se := range confirmed { - utxos[types.Hash256(se.ID)] = se + utxos[se.ID] = se } index := types.ChainIndex{ @@ -526,7 +524,7 @@ func (sw *SingleAddressWallet) UnconfirmedEvents() (annotated []Event, err error var outflow types.Currency for _, sci := range txn.SiacoinInputs { - sce, ok := utxos[types.Hash256(sci.ParentID)] + sce, ok := utxos[sci.ParentID] if !ok { // ignore inputs that don't belong to the wallet continue @@ -540,8 +538,8 @@ func (sw *SingleAddressWallet) UnconfirmedEvents() (annotated []Event, err error if so.Address == sw.addr { inflow = inflow.Add(so.Value) sce := types.SiacoinElement{ + ID: txn.SiacoinOutputID(i), StateElement: types.StateElement{ - ID: types.Hash256(txn.SiacoinOutputID(i)), LeafIndex: types.UnassignedLeafIndex, }, SiacoinOutput: so, @@ -591,15 +589,15 @@ func (sw *SingleAddressWallet) selectRedistributeUTXOs(bh uint64, outputs int, a } // fetch outputs currently in the pool - inPool := make(map[types.Hash256]bool) + inPool := make(map[types.SiacoinOutputID]bool) for _, txn := range sw.cm.PoolTransactions() { for _, sci := range txn.SiacoinInputs { - inPool[types.Hash256(sci.ParentID)] = true + inPool[sci.ParentID] = true } } for _, txn := range sw.cm.V2PoolTransactions() { for _, sci := range txn.SiacoinInputs { - inPool[types.Hash256(sci.Parent.ID)] = true + inPool[sci.Parent.ID] = true } } @@ -650,7 +648,7 @@ func (sw *SingleAddressWallet) Redistribute(outputs int, amount, feePerByte type defer func() { if err != nil { for _, id := range toSign { - delete(sw.locked, id) + delete(sw.locked, types.SiacoinOutputID(id)) } } }() @@ -712,7 +710,7 @@ func (sw *SingleAddressWallet) Redistribute(outputs int, amount, feePerByte type ParentID: types.SiacoinOutputID(sce.ID), UnlockConditions: types.StandardUnlockConditions(sw.priv.PublicKey()), }) - toSign = append(toSign, sce.ID) + toSign = append(toSign, types.Hash256(sce.ID)) sw.locked[sce.ID] = time.Now().Add(sw.cfg.ReservationDuration) } txns = append(txns, txn) @@ -819,7 +817,7 @@ func (sw *SingleAddressWallet) ReleaseInputs(txns []types.Transaction, v2txns [] defer sw.mu.Unlock() for _, txn := range txns { for _, in := range txn.SiacoinInputs { - delete(sw.locked, types.Hash256(in.ParentID)) + delete(sw.locked, in.ParentID) } } for _, txn := range v2txns { @@ -831,7 +829,7 @@ func (sw *SingleAddressWallet) ReleaseInputs(txns []types.Transaction, v2txns [] // isLocked returns true if the siacoin output with given id is locked, this // method must be called whilst holding the mutex lock. -func (sw *SingleAddressWallet) isLocked(id types.Hash256) bool { +func (sw *SingleAddressWallet) isLocked(id types.SiacoinOutputID) bool { return time.Now().Before(sw.locked[id]) } @@ -939,7 +937,7 @@ func NewSingleAddressWallet(priv types.PrivateKey, cm ChainManager, store Single addr: types.StandardUnlockHash(priv.PublicKey()), tip: tip, - locked: make(map[types.Hash256]time.Time), + locked: make(map[types.SiacoinOutputID]time.Time), } return sw, nil } From a13cde9e467b971aee9567f436b3085c29500485 Mon Sep 17 00:00:00 2001 From: Nate Maninger Date: Tue, 29 Oct 2024 15:59:45 -0700 Subject: [PATCH 4/4] remove addr prefix --- chain/network.go | 114 +++++++++++++++++++++++------------------------ 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/chain/network.go b/chain/network.go index 6fa2377..36da480 100644 --- a/chain/network.go +++ b/chain/network.go @@ -28,8 +28,8 @@ func Mainnet() (*consensus.Network, types.Block) { MaturityDelay: 144, } n.HardforkDevAddr.Height = 10000 - n.HardforkDevAddr.OldAddress = parseAddr("addr:7d0c44f7664e2d34e53efde0661a6f628ec9264785ae8e3cd7c973e8d190c3c97b5e3ecbc567") - n.HardforkDevAddr.NewAddress = parseAddr("addr:f371c70bce9eb8979cd5099f599ec4e4fcb14e0afcf31f9791e03e6496a4c0b358c98279730b") + n.HardforkDevAddr.OldAddress = parseAddr("7d0c44f7664e2d34e53efde0661a6f628ec9264785ae8e3cd7c973e8d190c3c97b5e3ecbc567") + n.HardforkDevAddr.NewAddress = parseAddr("f371c70bce9eb8979cd5099f599ec4e4fcb14e0afcf31f9791e03e6496a4c0b358c98279730b") n.HardforkTax.Height = 21000 @@ -44,8 +44,8 @@ func Mainnet() (*consensus.Network, types.Block) { n.HardforkASIC.OakTarget = types.BlockID{8: 32} n.HardforkFoundation.Height = 298000 - n.HardforkFoundation.PrimaryAddress = parseAddr("addr:053b2def3cbdd078c19d62ce2b4f0b1a3c5e0ffbeeff01280efb1f8969b2f5bb4fdc680f0807") - n.HardforkFoundation.FailsafeAddress = parseAddr("addr:27c22a6c6e6645802a3b8fa0e5374657438ef12716d2205d3e866272de1b644dbabd53d6d560") + n.HardforkFoundation.PrimaryAddress = parseAddr("053b2def3cbdd078c19d62ce2b4f0b1a3c5e0ffbeeff01280efb1f8969b2f5bb4fdc680f0807") + n.HardforkFoundation.FailsafeAddress = parseAddr("27c22a6c6e6645802a3b8fa0e5374657438ef12716d2205d3e866272de1b644dbabd53d6d560") n.HardforkV2.AllowHeight = 1000000 // TBD n.HardforkV2.RequireHeight = 1025000 // ~six months later @@ -54,53 +54,53 @@ func Mainnet() (*consensus.Network, types.Block) { Timestamp: n.HardforkOak.GenesisTimestamp, Transactions: []types.Transaction{{ SiafundOutputs: []types.SiafundOutput{ - {Address: parseAddr("addr:0439e5bc7f14ccf5d3a7e882d040923e45625166dd077b64466bc771791ac6fcec1c01394436"), Value: 2}, - {Address: parseAddr("addr:049e1d2a69772b058a48bebe65724ff3bdf8d0971ebbe994e1e91c9f13e84bf4cbfe00accf31"), Value: 6}, - {Address: parseAddr("addr:080742fa194af76ca24fdc97cae4f10b828a0df8c1a788c5413feaaecdd847e60a82a3240411"), Value: 7}, - {Address: parseAddr("addr:2c6aef338a66f213ccc5f8b2db7a98fb13143420af20049c4921a3a5deb8d9dad0132f50b83e"), Value: 8}, - {Address: parseAddr("addr:2ca31fe94a673784e69f614e9593416ea4d369ad9e1dca2b55d9554b5325cddf0a9dce86b3ed"), Value: 3}, - {Address: parseAddr("addr:33979254c7073b596face3c83e37a5fdeeba1c912f89c80f46c7bb7df368b3f0b3558938b515"), Value: 1}, - {Address: parseAddr("addr:3576fde5fee51c83e99c6c3ac59811a04afc0b3170f04277286272fb0556e975db9d7c89f72a"), Value: 10}, - {Address: parseAddr("addr:38db03321c03a65f8da3ca233cc7db0a97b0e461b085bd21d3ca53c51fd0fec1f15547ae6827"), Value: 50}, - {Address: parseAddr("addr:44be8c5760e89620a1b1cc41e4df57d9865a1938332d486b810c1dca0607320d17e8d839d6dd"), Value: 75}, - {Address: parseAddr("addr:450ec9c85a49f52d9a5ea113c7f1cb380d3f05dc79f5f734c2b5fc4c82067224b122c5e76e6b"), Value: 10}, - {Address: parseAddr("addr:4880fdcfa930011aedcda966c4e02aba5f973be2cb88fbdfa526586e2fd579e07734971fb805"), Value: 10}, - {Address: parseAddr("addr:4882a4e3da1c3c0f3897d4f24d83e8832a3984ad717642b7264f60b2696c1af78e4a9a422fee"), Value: 50}, - {Address: parseAddr("addr:4ad23ae46f45fd7835c36e1a734cd3cac79fcc0e4e5c0e83fa168dec9a2c278716b8262bc763"), Value: 10}, - {Address: parseAddr("addr:55c69a29c474e272ca5ed6935754f7a4c34f3a7b1a214441744fb5f1f1d0d7b84a9dc9c8570f"), Value: 15}, - {Address: parseAddr("addr:57ef537d980e1316cb882ec0cb57e0be4dec7d128edf92461017fc1364455b6f51b1fa676f01"), Value: 121}, - {Address: parseAddr("addr:5bc9650bbc28236fec851f7c61f68c888ff598ae6ff5bc7c157dbbc0cb5cfd392840fc664354"), Value: 222}, - {Address: parseAddr("addr:6ef0eead4e8ab98ab3e3879936842e3ee2cecc23ae6b9c0f8e025d84a33c3259d13856c1e0dd"), Value: 10}, - {Address: parseAddr("addr:723a932c404548b841b2d55e9d2c586a5c1f91c1d7c8d7e9637424c5a0464f99e3239e72af2b"), Value: 3}, - {Address: parseAddr("addr:7b6ae565dcfc32cb26b78598faa7d29bfc66961dbb03b2350b918f21a673fa28af705f308973"), Value: 1}, - {Address: parseAddr("addr:7c65cfaf3277cf1a3e0ff78d96ae49f7ee1c4dffde68a6f47056e350d72d458fb56774b79ac5"), Value: 5}, - {Address: parseAddr("addr:82b8480fe34fd9cd78fe43450a314cc2de1ef23e58b333751ba68c060716deb9a9e0b6e57bff"), Value: 10}, - {Address: parseAddr("addr:8689c6ac60362d0a64805be1e2868f6c1f46bbe436d446e5953940a6997beeb41ade41874fd4"), Value: 25}, - {Address: parseAddr("addr:8ffd76e56db58de05b907ba0cbdd7768ac0d694dabb97a36e5a80682a082b6970c6f75ba9fe1"), Value: 1}, - {Address: parseAddr("addr:936cf91024f96cb8c4d4f178db3f2db8563560cf8260d2fb8809c1a083c6ddb95ff49f2dcc2b"), Value: 8}, - {Address: parseAddr("addr:9b4f591c4547efc6f602c6fe5c3bc0cde59824ba6e7ae9dd4c8f03ee59e7c0170f50b34bd466"), Value: 58}, - {Address: parseAddr("addr:9c204c69d52e42321b5538096ac15091136554b191047d1c4ffc2b53766ecef779841cccf546"), Value: 2}, - {Address: parseAddr("addr:9da98618fe163abc7757c9ee37a8c283581227a82502c6c25dca7492bd116c2c2e5a86444683"), Value: 23}, - {Address: parseAddr("addr:9e336824f2724310a8e6046ff148050eb666a99c90dc6775df083abb7c66502c56b50ade1bbe"), Value: 10}, - {Address: parseAddr("addr:a0af3b21df1e523c226e1ccbf95d0310da0cface8ae7554345bf44c6a0579a449147262278ed"), Value: 1}, - {Address: parseAddr("addr:a35e33dc0e9053703e0a00ada1ead3b0ba5409bdfa6f21e77257644b48d90b1ae624efa81a35"), Value: 75}, - {Address: parseAddr("addr:aa078a74cd1484c5a6fb4b5d45066df4d477ad72221219156fcbcbfd8a681b2401feb5794149"), Value: 3}, - {Address: parseAddr("addr:ad788068ba56978cbf17e7c14df5f368c4379bf36f0f548b94bbad2f68458d2737e27e3ab0f1"), Value: 90}, - {Address: parseAddr("addr:b3b9e4a68b5e0dc1ffe3ae6378696dddf7049bf3e5251a62de0c5b50df213d386b6c17b6b3d1"), Value: 20}, - {Address: parseAddr("addr:c1316714aa87b65595129fc29878a2d0319edcbc724f01833e1b5639f42e40423fad6b983ec8"), Value: 5}, - {Address: parseAddr("addr:c4472dde00150c79c5e065412839137770cda617025b4be7458fdd44f54b0734caecae6c80eb"), Value: 1}, - {Address: parseAddr("addr:c4d6ecd3e3d8987fa402eb0eeb2e8ee753260783d01db3bd3e5881b4779ed661845aa2af4e21"), Value: 44}, - {Address: parseAddr("addr:ce3a7294833157c55612d81a3e4f98af210484a06ce735c8304c7d5e9c552082ac1f789b0e3c"), Value: 23}, - {Address: parseAddr("addr:c867877ec502cb3ff106f5c3dc661b4ae8f9c956cf22331ab497886c7038844822ada408c0a1"), Value: 80}, - {Address: parseAddr("addr:c8f9f5da3afd4cfa587246ef0e02fa7b0ac0c63dbb9bf798a5aec6188e27b177f3bb2c91f98b"), Value: 2}, - {Address: parseAddr("addr:d101c7b8ba39158921fcdbb8822620623ffcfa4f4692a94eb4a11d5d262dafb015701c1f3ad2"), Value: 1}, - {Address: parseAddr("addr:d46be92bb98a4ffd0cedd611dbc6975c518111788b3a42777edc8488036c393a84e5e9d47013"), Value: 2}, - {Address: parseAddr("addr:d6f492adad5021b91d854da7b90126176fb3689669a2781af53f727734012cdeb00112f1695a"), Value: 3}, - {Address: parseAddr("addr:d9daac103586a0e22c8a5d35b53e04d1be1b005d6911a93d62918370793761b8ef4e7df47eb8"), Value: 1}, - {Address: parseAddr("addr:dfa2ac3736c1258ec8d5e630ba91b8ce0fe1a713254626308757cd51bbedb5b4e0474feb510f"), Value: 1}, - {Address: parseAddr("addr:f12e8b29283f2fa983ad7cf6e4d5662c64d93eed859af845e40224ce2ffaf9aacfea794fb954"), Value: 1}, - {Address: parseAddr("addr:f132e5d3422073f17557b4ef4cf60e8169b5996969cbe5ed1782c1aa64c9264785a9b56481f6"), Value: 50}, - {Address: parseAddr("addr:7d0c44f7664e2d34e53efde0661a6f628ec9264785ae8e3cd7c973e8d190c3c97b5e3ecbc567"), Value: 8841}, + {Address: parseAddr("0439e5bc7f14ccf5d3a7e882d040923e45625166dd077b64466bc771791ac6fcec1c01394436"), Value: 2}, + {Address: parseAddr("049e1d2a69772b058a48bebe65724ff3bdf8d0971ebbe994e1e91c9f13e84bf4cbfe00accf31"), Value: 6}, + {Address: parseAddr("080742fa194af76ca24fdc97cae4f10b828a0df8c1a788c5413feaaecdd847e60a82a3240411"), Value: 7}, + {Address: parseAddr("2c6aef338a66f213ccc5f8b2db7a98fb13143420af20049c4921a3a5deb8d9dad0132f50b83e"), Value: 8}, + {Address: parseAddr("2ca31fe94a673784e69f614e9593416ea4d369ad9e1dca2b55d9554b5325cddf0a9dce86b3ed"), Value: 3}, + {Address: parseAddr("33979254c7073b596face3c83e37a5fdeeba1c912f89c80f46c7bb7df368b3f0b3558938b515"), Value: 1}, + {Address: parseAddr("3576fde5fee51c83e99c6c3ac59811a04afc0b3170f04277286272fb0556e975db9d7c89f72a"), Value: 10}, + {Address: parseAddr("38db03321c03a65f8da3ca233cc7db0a97b0e461b085bd21d3ca53c51fd0fec1f15547ae6827"), Value: 50}, + {Address: parseAddr("44be8c5760e89620a1b1cc41e4df57d9865a1938332d486b810c1dca0607320d17e8d839d6dd"), Value: 75}, + {Address: parseAddr("450ec9c85a49f52d9a5ea113c7f1cb380d3f05dc79f5f734c2b5fc4c82067224b122c5e76e6b"), Value: 10}, + {Address: parseAddr("4880fdcfa930011aedcda966c4e02aba5f973be2cb88fbdfa526586e2fd579e07734971fb805"), Value: 10}, + {Address: parseAddr("4882a4e3da1c3c0f3897d4f24d83e8832a3984ad717642b7264f60b2696c1af78e4a9a422fee"), Value: 50}, + {Address: parseAddr("4ad23ae46f45fd7835c36e1a734cd3cac79fcc0e4e5c0e83fa168dec9a2c278716b8262bc763"), Value: 10}, + {Address: parseAddr("55c69a29c474e272ca5ed6935754f7a4c34f3a7b1a214441744fb5f1f1d0d7b84a9dc9c8570f"), Value: 15}, + {Address: parseAddr("57ef537d980e1316cb882ec0cb57e0be4dec7d128edf92461017fc1364455b6f51b1fa676f01"), Value: 121}, + {Address: parseAddr("5bc9650bbc28236fec851f7c61f68c888ff598ae6ff5bc7c157dbbc0cb5cfd392840fc664354"), Value: 222}, + {Address: parseAddr("6ef0eead4e8ab98ab3e3879936842e3ee2cecc23ae6b9c0f8e025d84a33c3259d13856c1e0dd"), Value: 10}, + {Address: parseAddr("723a932c404548b841b2d55e9d2c586a5c1f91c1d7c8d7e9637424c5a0464f99e3239e72af2b"), Value: 3}, + {Address: parseAddr("7b6ae565dcfc32cb26b78598faa7d29bfc66961dbb03b2350b918f21a673fa28af705f308973"), Value: 1}, + {Address: parseAddr("7c65cfaf3277cf1a3e0ff78d96ae49f7ee1c4dffde68a6f47056e350d72d458fb56774b79ac5"), Value: 5}, + {Address: parseAddr("82b8480fe34fd9cd78fe43450a314cc2de1ef23e58b333751ba68c060716deb9a9e0b6e57bff"), Value: 10}, + {Address: parseAddr("8689c6ac60362d0a64805be1e2868f6c1f46bbe436d446e5953940a6997beeb41ade41874fd4"), Value: 25}, + {Address: parseAddr("8ffd76e56db58de05b907ba0cbdd7768ac0d694dabb97a36e5a80682a082b6970c6f75ba9fe1"), Value: 1}, + {Address: parseAddr("936cf91024f96cb8c4d4f178db3f2db8563560cf8260d2fb8809c1a083c6ddb95ff49f2dcc2b"), Value: 8}, + {Address: parseAddr("9b4f591c4547efc6f602c6fe5c3bc0cde59824ba6e7ae9dd4c8f03ee59e7c0170f50b34bd466"), Value: 58}, + {Address: parseAddr("9c204c69d52e42321b5538096ac15091136554b191047d1c4ffc2b53766ecef779841cccf546"), Value: 2}, + {Address: parseAddr("9da98618fe163abc7757c9ee37a8c283581227a82502c6c25dca7492bd116c2c2e5a86444683"), Value: 23}, + {Address: parseAddr("9e336824f2724310a8e6046ff148050eb666a99c90dc6775df083abb7c66502c56b50ade1bbe"), Value: 10}, + {Address: parseAddr("a0af3b21df1e523c226e1ccbf95d0310da0cface8ae7554345bf44c6a0579a449147262278ed"), Value: 1}, + {Address: parseAddr("a35e33dc0e9053703e0a00ada1ead3b0ba5409bdfa6f21e77257644b48d90b1ae624efa81a35"), Value: 75}, + {Address: parseAddr("aa078a74cd1484c5a6fb4b5d45066df4d477ad72221219156fcbcbfd8a681b2401feb5794149"), Value: 3}, + {Address: parseAddr("ad788068ba56978cbf17e7c14df5f368c4379bf36f0f548b94bbad2f68458d2737e27e3ab0f1"), Value: 90}, + {Address: parseAddr("b3b9e4a68b5e0dc1ffe3ae6378696dddf7049bf3e5251a62de0c5b50df213d386b6c17b6b3d1"), Value: 20}, + {Address: parseAddr("c1316714aa87b65595129fc29878a2d0319edcbc724f01833e1b5639f42e40423fad6b983ec8"), Value: 5}, + {Address: parseAddr("c4472dde00150c79c5e065412839137770cda617025b4be7458fdd44f54b0734caecae6c80eb"), Value: 1}, + {Address: parseAddr("c4d6ecd3e3d8987fa402eb0eeb2e8ee753260783d01db3bd3e5881b4779ed661845aa2af4e21"), Value: 44}, + {Address: parseAddr("ce3a7294833157c55612d81a3e4f98af210484a06ce735c8304c7d5e9c552082ac1f789b0e3c"), Value: 23}, + {Address: parseAddr("c867877ec502cb3ff106f5c3dc661b4ae8f9c956cf22331ab497886c7038844822ada408c0a1"), Value: 80}, + {Address: parseAddr("c8f9f5da3afd4cfa587246ef0e02fa7b0ac0c63dbb9bf798a5aec6188e27b177f3bb2c91f98b"), Value: 2}, + {Address: parseAddr("d101c7b8ba39158921fcdbb8822620623ffcfa4f4692a94eb4a11d5d262dafb015701c1f3ad2"), Value: 1}, + {Address: parseAddr("d46be92bb98a4ffd0cedd611dbc6975c518111788b3a42777edc8488036c393a84e5e9d47013"), Value: 2}, + {Address: parseAddr("d6f492adad5021b91d854da7b90126176fb3689669a2781af53f727734012cdeb00112f1695a"), Value: 3}, + {Address: parseAddr("d9daac103586a0e22c8a5d35b53e04d1be1b005d6911a93d62918370793761b8ef4e7df47eb8"), Value: 1}, + {Address: parseAddr("dfa2ac3736c1258ec8d5e630ba91b8ce0fe1a713254626308757cd51bbedb5b4e0474feb510f"), Value: 1}, + {Address: parseAddr("f12e8b29283f2fa983ad7cf6e4d5662c64d93eed859af845e40224ce2ffaf9aacfea794fb954"), Value: 1}, + {Address: parseAddr("f132e5d3422073f17557b4ef4cf60e8169b5996969cbe5ed1782c1aa64c9264785a9b56481f6"), Value: 50}, + {Address: parseAddr("7d0c44f7664e2d34e53efde0661a6f628ec9264785ae8e3cd7c973e8d190c3c97b5e3ecbc567"), Value: 8841}, }, }}, } @@ -138,7 +138,7 @@ func TestnetZen() (*consensus.Network, types.Block) { n.HardforkASIC.OakTarget = types.BlockID{3: 1} n.HardforkFoundation.Height = 30 - n.HardforkFoundation.PrimaryAddress = parseAddr("addr:053b2def3cbdd078c19d62ce2b4f0b1a3c5e0ffbeeff01280efb1f8969b2f5bb4fdc680f0807") + n.HardforkFoundation.PrimaryAddress = parseAddr("053b2def3cbdd078c19d62ce2b4f0b1a3c5e0ffbeeff01280efb1f8969b2f5bb4fdc680f0807") n.HardforkFoundation.FailsafeAddress = types.VoidAddress n.HardforkV2.AllowHeight = 100000 // TBD @@ -148,11 +148,11 @@ func TestnetZen() (*consensus.Network, types.Block) { Timestamp: n.HardforkOak.GenesisTimestamp, Transactions: []types.Transaction{{ SiacoinOutputs: []types.SiacoinOutput{{ - Address: parseAddr("addr:3d7f707d05f2e0ec7ccc9220ed7c8af3bc560fbee84d068c2cc28151d617899e1ee8bc069946"), + Address: parseAddr("3d7f707d05f2e0ec7ccc9220ed7c8af3bc560fbee84d068c2cc28151d617899e1ee8bc069946"), Value: types.Siacoins(1).Mul64(1e12), }}, SiafundOutputs: []types.SiafundOutput{{ - Address: parseAddr("addr:053b2def3cbdd078c19d62ce2b4f0b1a3c5e0ffbeeff01280efb1f8969b2f5bb4fdc680f0807"), + Address: parseAddr("053b2def3cbdd078c19d62ce2b4f0b1a3c5e0ffbeeff01280efb1f8969b2f5bb4fdc680f0807"), Value: 10000, }}, }}, @@ -172,16 +172,16 @@ func TestnetAnagami() (*consensus.Network, types.Block) { n.HardforkV2.AllowHeight = 2016 // ~2 weeks in n.HardforkV2.RequireHeight = 2016 + 288 // ~2 days later - n.HardforkFoundation.PrimaryAddress = parseAddr("addr:241352c83da002e61f57e96b14f3a5f8b5de22156ce83b753ea495e64f1affebae88736b2347") + n.HardforkFoundation.PrimaryAddress = parseAddr("241352c83da002e61f57e96b14f3a5f8b5de22156ce83b753ea495e64f1affebae88736b2347") n.HardforkFoundation.FailsafeAddress = types.VoidAddress // move the genesis airdrops for easier testing genesis.Transactions[0].SiacoinOutputs = []types.SiacoinOutput{{ - Address: parseAddr("addr:241352c83da002e61f57e96b14f3a5f8b5de22156ce83b753ea495e64f1affebae88736b2347"), + Address: parseAddr("241352c83da002e61f57e96b14f3a5f8b5de22156ce83b753ea495e64f1affebae88736b2347"), Value: types.Siacoins(1).Mul64(1e12), }} genesis.Transactions[0].SiafundOutputs = []types.SiafundOutput{{ - Address: parseAddr("addr:241352c83da002e61f57e96b14f3a5f8b5de22156ce83b753ea495e64f1affebae88736b2347"), + Address: parseAddr("241352c83da002e61f57e96b14f3a5f8b5de22156ce83b753ea495e64f1affebae88736b2347"), Value: 10000, }} return n, genesis