Commit 0a5de60e authored by Paladz's avatar Paladz Committed by GitHub

Merge pull request #1729 from Bytom/dev

Dev
parents 8b73700d 5e84d0e5
......@@ -85,7 +85,7 @@ func (a *API) submitBlock(ctx context.Context, req *SubmitBlockReq) Response {
return NewErrorResponse(errors.New("block submitted is orphan"))
}
if err = a.eventDispatcher.Post(event.NewMinedBlockEvent{Block: req.Block}); err != nil {
if err = a.eventDispatcher.Post(event.NewMinedBlockEvent{Block: *req.Block}); err != nil {
return NewErrorResponse(err)
}
......
......@@ -133,6 +133,8 @@ var MainNetParams = Params{
{157000, bc.NewHash([32]byte{0xb7, 0x70, 0x38, 0x4c, 0x81, 0x32, 0xaf, 0x12, 0x8d, 0xfa, 0xb4, 0xeb, 0x46, 0x4e, 0xb7, 0xeb, 0x66, 0x14, 0xd9, 0x24, 0xc2, 0xd1, 0x0c, 0x9c, 0x14, 0x20, 0xc9, 0xea, 0x0e, 0x85, 0xc8, 0xc3})},
{180000, bc.NewHash([32]byte{0x3c, 0x2a, 0x91, 0x55, 0xf3, 0x36, 0x6a, 0x5a, 0x60, 0xcf, 0x84, 0x42, 0xec, 0x4d, 0x0c, 0x63, 0xbc, 0x34, 0xe9, 0x1d, 0x1c, 0x6b, 0xb0, 0xf0, 0x50, 0xf3, 0xfb, 0x2d, 0xf6, 0xa1, 0xd9, 0x5c})},
{191000, bc.NewHash([32]byte{0x09, 0x4f, 0xe3, 0x23, 0x91, 0xb5, 0x11, 0x18, 0x68, 0xcc, 0x99, 0x9f, 0xeb, 0x95, 0xf9, 0xcc, 0xa5, 0x27, 0x6a, 0xf9, 0x0e, 0xda, 0x1b, 0xc6, 0x2e, 0x03, 0x29, 0xfe, 0x08, 0xdd, 0x2b, 0x01})},
{205000, bc.NewHash([32]byte{0x6f, 0xdd, 0x87, 0x26, 0x73, 0x3f, 0x0b, 0xc7, 0x58, 0x64, 0xa4, 0xdf, 0x45, 0xe4, 0x50, 0x27, 0x68, 0x38, 0x18, 0xb9, 0xa9, 0x44, 0x56, 0x20, 0x34, 0x68, 0xd8, 0x68, 0x72, 0xdb, 0x65, 0x6f})},
{219700, bc.NewHash([32]byte{0x98, 0x49, 0x8d, 0x4b, 0x7e, 0xe9, 0x44, 0x55, 0xc1, 0x07, 0xdd, 0x9a, 0xba, 0x6b, 0x49, 0x92, 0x61, 0x15, 0x03, 0x4f, 0x59, 0x42, 0x35, 0x74, 0xea, 0x3b, 0xdb, 0x2c, 0x53, 0x11, 0x75, 0x74})},
},
}
......
This diff is collapsed.
Bytom version 1.0.9 is now available from:
https://github.com/Bytom/bytom/releases/tag/v1.0.9
Please report bugs using the issue tracker at github:
https://github.com/Bytom/bytom/issues
How to Upgrade
===============
If you are running an older version, shut it down. Wait until it has quited completely, and then run the new version Bytom.
You can operate according to the user manual.[(Bytom User Manual)](https://bytom.io/wp-content/themes/freddo/images/wallet/BytomUsermanualV1.0_en.pdf)
1.0.9 changelog
================
__Bytom Node__
+ `PR #1657`
- Save the index for all history transactions when "txindex" flag is provided for the purpose of future querying.
+ `PR #1659`
- Add dust transaction filter rule to filer the transaction with dust output amount.
+ `PR #1662`
- Add a keep_dial option in order to automatically retry connecting to provided peers.
+ `PR #1677`
- Add a custom node alias feature, support custom the node's name by the configuration.
+ `PR #1687`
- Support mDNS LAN peer discover to reduce the network bandwidth required for communication.
+ `PR #1692`
- Add ugly transaction test that may occur in several scenes such as insufficient fee, unbalanced transaction, overflow, and signature fail tests.
+ `PR #1697`
- Precisely estimate gas for standard transaction and issue transaction.
+ `PR #1698`
- Add timestamp as random number generator seed number, ensure random number security.
__Bytom Dashboard__
- Update the Json structure and add new form stepper for the create asset page.
- Add the issue asset option under the new transactions page. Support multi-signature under the issue asset transactions.
Credits
--------
Thanks to everyone who directly contributed to this release:
- Agouri
- Colt-Z
- HAOYUatHZ
- langyu
- Paladz
- shenao78
- shengling2008
- yahtoo
- zcc0721
- ZhitingLin
And everyone who helped test.
......@@ -24,7 +24,7 @@ var (
ErrDuplicateSubscribe = errors.New("event: subscribe duplicate type")
)
type NewMinedBlockEvent struct{ Block *types.Block }
type NewMinedBlockEvent struct{ Block types.Block }
// TypeMuxEvent is a time-tagged notification pushed to subscribers.
type TypeMuxEvent struct {
......
......@@ -102,7 +102,7 @@ out:
}).Info("Miner processed block")
// Broadcast the block and announce chain insertion event
if err = m.eventDispatcher.Post(event.NewMinedBlockEvent{Block: block}); err != nil {
if err = m.eventDispatcher.Post(event.NewMinedBlockEvent{Block: *block}); err != nil {
log.WithFields(log.Fields{"module": logModule, "height": block.BlockHeader.Height, "error": err}).Errorf("Miner fail on post block")
}
} else {
......
......@@ -121,7 +121,7 @@ func (m *MiningPool) submitWork(bh *types.BlockHeader) error {
return errors.New("submit result is orphan")
}
if err := m.eventDispatcher.Post(event.NewMinedBlockEvent{Block: m.block}); err != nil {
if err := m.eventDispatcher.Post(event.NewMinedBlockEvent{Block: *m.block}); err != nil {
return err
}
......
......@@ -480,7 +480,7 @@ func (sm *SyncManager) minedBroadcastLoop() {
continue
}
if err := sm.peers.broadcastMinedBlock(ev.Block); err != nil {
if err := sm.peers.broadcastMinedBlock(&ev.Block); err != nil {
log.WithFields(log.Fields{"module": logModule, "err": err}).Error("fail on broadcast mine block")
continue
}
......
......@@ -67,7 +67,7 @@ type DynamicBanScore struct {
func (s *DynamicBanScore) String() string {
s.mtx.Lock()
r := fmt.Sprintf("persistent %v + transient %v at %v = %v as of now",
s.persistent, s.transient, s.lastUnix, s.Int())
s.persistent, s.transient, s.lastUnix, s.int(time.Now()))
s.mtx.Unlock()
return r
}
......
......@@ -77,3 +77,16 @@ func TestReset(t *testing.T) {
t.Errorf("Failed to reset ban score.")
}
}
func TestString(t *testing.T) {
want := "persistent 100 + transient 0 at 0 = 100 as of now"
var bs DynamicBanScore
if bs.Int() != 0 {
t.Errorf("Initial state is not zero.")
}
bs.Increase(100, 0)
if bs.String() != want {
t.Fatal("DynamicBanScore String test error.")
}
}
......@@ -201,6 +201,56 @@ func TestWalletUpdate(t *testing.T) {
}
}
func TestRescanWallet(t *testing.T) {
// prepare wallet & db
dirPath, err := ioutil.TempDir(".", "")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(dirPath)
testDB := dbm.NewDB("testdb", "leveldb", "temp")
defer os.RemoveAll("temp")
store := database.NewStore(testDB)
dispatcher := event.NewDispatcher()
txPool := protocol.NewTxPool(store, dispatcher)
chain, err := protocol.NewChain(store, txPool)
if err != nil {
t.Fatal(err)
}
statusInfo := StatusInfo{
Version: currentVersion,
WorkHash: bc.Hash{V0: 0xff},
}
rawWallet, err := json.Marshal(statusInfo)
if err != nil {
t.Fatal("save wallet info")
}
w := mockWallet(testDB, nil, nil, chain, dispatcher, false)
w.DB.Set(walletKey, rawWallet)
rawWallet = w.DB.Get(walletKey)
if rawWallet == nil {
t.Fatal("fail to load wallet StatusInfo")
}
if err := json.Unmarshal(rawWallet, &w.status); err != nil {
t.Fatal(err)
}
// rescan wallet
if err := w.loadWalletInfo(); err != nil {
t.Fatal(err)
}
block := config.GenesisBlock()
if w.status.WorkHash != block.Hash() {
t.Fatal("reattach from genesis block")
}
}
func TestMemPoolTxQueryLoop(t *testing.T) {
dirPath, err := ioutil.TempDir(".", "")
if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment