Compare commits

..

No commits in common. "ce8efb98901ee5a16f2d4f7c3274ac0c0345a038" and "6422ec378347fa81b1aef0157df7b3cb35bf6aa0" have entirely different histories.

1 changed files with 8 additions and 8 deletions

View File

@ -216,19 +216,19 @@ func update_block_confirm(gbt *GbtAlphContext) {
if checkResult { if checkResult {
blockInfo := gbt.GbtCtx.ClientAlphApi.GetBlcokInfo(blockHash) blockInfo := gbt.GbtCtx.ClientAlphApi.GetBlcokInfo(blockHash)
var total_amount float64 = 0 var total_amount float64 = 0
fromGroup, toGroup, nonce, height := blockInfo.ChainFrom, blockInfo.ChainTo, blockInfo.Nonce, blockInfo.Height fromGroup, toGroup, nonce, height, input, output := blockInfo.ChainFrom, blockInfo.ChainTo, blockInfo.Nonce, blockInfo.Height, blockInfo.Transactions[len(blockInfo.Transactions)-1].Unsigned.Inputs, blockInfo.Transactions[len(blockInfo.Transactions)-1].Unsigned.FixedOutputs
for _, tx := range blockInfo.Transactions { if len(input) == 0 {
for _, out := range tx.Unsigned.FixedOutputs { for v := range output {
if out.Address == addr[fromGroup] && nonce == blockInfo.Nonce { address, amount := output[v].Address, output[v].AttoAlphAmount
amount := out.AttoAlphAmount if address == addr[fromGroup] && nonce == block.Nonce {
total_amount += savePoint4(stringToFloat64(amount) / math.Pow(10, 18)) total_amount += savePoint4(stringToFloat64(amount) / math.Pow(10, 18))
fmt.Println(fromGroup, "->", toGroup, "(", height, ")", total_amount, ",", nonce, " ", blockHash, " ", out.Address, " 报块成功") fmt.Println(fromGroup, "->", toGroup, "(", height, ")", total_amount, ",", nonce, " ", blockHash, " ", address, " 报块成功")
} else { } else {
fmt.Println(fromGroup, "->", toGroup, "(", height, ")", total_amount, ",", nonce, "不是报块,实际报块地址为:", out.Address) fmt.Println(fromGroup, "->", toGroup, "(", height, ")", total_amount, ",", nonce, "不是报块,实际报块地址为:", address)
} }
} }
} }
block_height := height // 用区块链返回的height防止某个块成为下一个高度的叔块导致高度变化 block_height := int64(block.Height)
dbif.AlphNotifyPoolBlkStatsSuccess(gbt.GbtCtx, uint32(fromGroup), uint32(toGroup), block_height, "", block.Nonce, int64(block.SubIdx), total_amount, 0) dbif.AlphNotifyPoolBlkStatsSuccess(gbt.GbtCtx, uint32(fromGroup), uint32(toGroup), block_height, "", block.Nonce, int64(block.SubIdx), total_amount, 0)
dbif.NotifyAlphBlkDetailSuccess(gbt.GbtCtx, uint32(fromGroup), uint32(toGroup), block_height, "", block.Nonce, int64(block.SubIdx)) dbif.NotifyAlphBlkDetailSuccess(gbt.GbtCtx, uint32(fromGroup), uint32(toGroup), block_height, "", block.Nonce, int64(block.SubIdx))
dbif.NotifyAlphBlkNewDb(gbt.GbtCtx, uint32(fromGroup), uint32(toGroup), block_height, block.Hash, true, block.Nonce, int64(block.SubIdx)) dbif.NotifyAlphBlkNewDb(gbt.GbtCtx, uint32(fromGroup), uint32(toGroup), block_height, block.Hash, true, block.Nonce, int64(block.SubIdx))