Skip to content

Commit

Permalink
Merge branch 'its-happening'
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechampine committed Sep 30, 2023
2 parents ad76cac + a7b05a3 commit df82343
Show file tree
Hide file tree
Showing 79 changed files with 6,293 additions and 21,376 deletions.
624 changes: 329 additions & 295 deletions chain/db.go

Large diffs are not rendered by default.

592 changes: 435 additions & 157 deletions chain/manager.go

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions chain/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ func TestManager(t *testing.T) {

n.InitialTarget = types.BlockID{0xFF}

store, checkpoint, err := NewDBStore(NewMemDB(), n, genesisBlock)
store, tipState, err := NewDBStore(NewMemDB(), n, genesisBlock)
if err != nil {
t.Fatal(err)
}
defer store.Close()
cm := NewManager(store, checkpoint.State)
cm := NewManager(store, tipState)

var hs historySubscriber
cm.AddSubscriber(&hs, cm.Tip())
Expand All @@ -60,7 +60,7 @@ func TestManager(t *testing.T) {
}},
}
findBlockNonce(cs, &b)
cs = consensus.ApplyState(cs, store, b)
cs, _ = consensus.ApplyBlock(cs, b, store.SupplementTipBlock(b), ancestorTimestamp(store, b.ParentID, cs.AncestorDepth()))
blocks = append(blocks, b)
}
return
Expand Down Expand Up @@ -106,7 +106,7 @@ func TestTxPool(t *testing.T) {

giftPrivateKey := types.GeneratePrivateKey()
giftPublicKey := giftPrivateKey.PublicKey()
giftAddress := giftPublicKey.StandardAddress()
giftAddress := types.StandardUnlockHash(giftPublicKey)
giftAmountSC := types.Siacoins(100)
giftTxn := types.Transaction{
SiacoinOutputs: []types.SiacoinOutput{
Expand All @@ -115,11 +115,11 @@ func TestTxPool(t *testing.T) {
}
genesisBlock.Transactions = []types.Transaction{giftTxn}

store, checkpoint, err := NewDBStore(NewMemDB(), n, genesisBlock)
store, tipState, err := NewDBStore(NewMemDB(), n, genesisBlock)
if err != nil {
t.Fatal(err)
}
cm := NewManager(store, checkpoint.State)
cm := NewManager(store, tipState)

signTxn := func(txn *types.Transaction) {
for _, sci := range txn.SiacoinInputs {
Expand All @@ -137,7 +137,7 @@ func TestTxPool(t *testing.T) {
parentTxn := types.Transaction{
SiacoinInputs: []types.SiacoinInput{{
ParentID: giftTxn.SiacoinOutputID(0),
UnlockConditions: giftPublicKey.StandardUnlockConditions(),
UnlockConditions: types.StandardUnlockConditions(giftPublicKey),
}},
SiacoinOutputs: []types.SiacoinOutput{{
Address: giftAddress,
Expand All @@ -155,7 +155,7 @@ func TestTxPool(t *testing.T) {
childTxn := types.Transaction{
SiacoinInputs: []types.SiacoinInput{{
ParentID: parentTxn.SiacoinOutputID(0),
UnlockConditions: giftPublicKey.StandardUnlockConditions(),
UnlockConditions: types.StandardUnlockConditions(giftPublicKey),
}},
MinerFees: []types.Currency{giftAmountSC},
}
Expand Down
6 changes: 6 additions & 0 deletions chain/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ func Mainnet() (*consensus.Network, types.Block) {
n.HardforkFoundation.PrimaryAddress = parseAddr("addr:053b2def3cbdd078c19d62ce2b4f0b1a3c5e0ffbeeff01280efb1f8969b2f5bb4fdc680f0807")
n.HardforkFoundation.FailsafeAddress = parseAddr("addr:27c22a6c6e6645802a3b8fa0e5374657438ef12716d2205d3e866272de1b644dbabd53d6d560")

n.HardforkV2.AllowHeight = 1000000 // TBD
n.HardforkV2.RequireHeight = 1025000 // ~six months later

b := types.Block{
Timestamp: n.HardforkOak.GenesisTimestamp,
Transactions: []types.Transaction{{
Expand Down Expand Up @@ -134,6 +137,9 @@ func TestnetZen() (*consensus.Network, types.Block) {
n.HardforkFoundation.PrimaryAddress = parseAddr("addr:053b2def3cbdd078c19d62ce2b4f0b1a3c5e0ffbeeff01280efb1f8969b2f5bb4fdc680f0807")
n.HardforkFoundation.FailsafeAddress = types.VoidAddress

n.HardforkV2.AllowHeight = 30000 // TBD
n.HardforkV2.RequireHeight = 32000 // ~two weeks later

b := types.Block{
Timestamp: n.HardforkOak.GenesisTimestamp,
Transactions: []types.Transaction{{
Expand Down
Loading

0 comments on commit df82343

Please sign in to comment.