From aca1d8f8e8b2614d4332fe94682fc58b387fcc67 Mon Sep 17 00:00:00 2001 From: Captain Date: Sun, 20 Mar 2022 11:54:16 +0000 Subject: [PATCH] HardFork at block-6713000 to limit emission of Atlantis. --- blockchain/blockchain.go | 5 +++++ blockchain/hardfork_core.go | 2 ++ config/config.go | 2 ++ config/version.go | 2 +- go.mod | 3 +++ walletapi/wallet_transfer.go | 3 ++- 6 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 go.mod diff --git a/blockchain/blockchain.go b/blockchain/blockchain.go index c9c46ad..7cbe1b5 100644 --- a/blockchain/blockchain.go +++ b/blockchain/blockchain.go @@ -1216,6 +1216,11 @@ skip_checks: // and leave the original TX untouched total_reward := base_reward + total_fees + if hard_fork_version_current >= 5 { + total_reward = 1 // 1 atomic unit + base_reward = 0 // 0 atomic unit + } + // store total reward dbtx.StoreUint64(BLOCKCHAIN_UNIVERSE, GALAXY_BLOCK, bl_current_hash[:], PLANET_MINERTX_REWARD, total_reward) diff --git a/blockchain/hardfork_core.go b/blockchain/hardfork_core.go index 8f3e87d..2ef51bf 100644 --- a/blockchain/hardfork_core.go +++ b/blockchain/hardfork_core.go @@ -50,6 +50,7 @@ var mainnet_hard_forks = []Hard_fork{ {2, 95551, 0, 0, 0, true}, // version 2 hard fork where Atlantis bootstraps , it's mandatory {3, 721000, 0, 0, 0, true}, // version 3 hard fork emission fix, it's mandatory {4, 4550555, 0, 0, 0, true}, // version 4 hard fork AstroBWT CPU Mining enabled. It's mandatory + {5, config.HF5_HEIGHT, 0, 0, 0, true}, // version 5 hard fork where we keep the chain alive, so who could not swap earlier can swap later } // current testnet_hard_forks @@ -57,6 +58,7 @@ var testnet_hard_forks = []Hard_fork{ //{1, 0, 0, 0, 0, true}, // version 1 hard fork where genesis block landed {3, 0, 0, 0, 0, true}, // version 3 hard fork where we started , it's mandatory {4, 3, 0, 0, 0, true}, // version 4 hard fork where we change mining algorithm it's mandatory + {5, 4, 0, 0, 0, true}, // version 5 hard fork where we keep the chain alive, so who could not swap earlier can swap later } // current simulation_hard_forks diff --git a/config/config.go b/config/config.go index 3422d8a..ec904d8 100644 --- a/config/config.go +++ b/config/config.go @@ -93,6 +93,8 @@ const MAINNET_MINIMUM_DIFFICULTY = uint64(5* 1000 * BLOCK_TIME_hf4) // 5 KH/s const TESTNET_BOOTSTRAP_DIFFICULTY = uint64(1600 * BLOCK_TIME_hf4) // testnet bootstrap at 800 H/s const TESTNET_MINIMUM_DIFFICULTY = uint64(800 * BLOCK_TIME_hf4) // 800 H +const HF5_HEIGHT = 6713000 // hf applies at this height + // this single parameter controls lots of various parameters // within the consensus, it should never go below 7 diff --git a/config/version.go b/config/version.go index 0ac4d94..98ac7a0 100644 --- a/config/version.go +++ b/config/version.go @@ -20,4 +20,4 @@ import "github.com/blang/semver" // right now it has to be manually changed // do we need to include git commitsha?? -var Version = semver.MustParse("2.2.1-0.Atlantis.Astrobwt+03072020") +var Version = semver.MustParse("2.2.2-13.Atlantis.Astrobwt+11032022") diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..b312791 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/deroproject/derosuite + +go 1.17 diff --git a/walletapi/wallet_transfer.go b/walletapi/wallet_transfer.go index eba4f5a..cf4bb4b 100644 --- a/walletapi/wallet_transfer.go +++ b/walletapi/wallet_transfer.go @@ -716,7 +716,8 @@ func (w *Wallet) select_outputs_for_transfer(needed_amount uint64, fees uint64, continue } - if inputmaturity.Is_Input_Mature(w.Get_Height(), + // do not select indexes which are past HF and which are dust + if tx.TXdata.Height <= config.HF5_HEIGHT && tx.WAmount > 20 && inputmaturity.Is_Input_Mature(w.Get_Height(), tx.TXdata.Height, tx.TXdata.Unlock_Height, tx.TXdata.SigType) && !w.IsKeyImageSpent(tx.WKimage) {