fix gbt bug
This commit is contained in:
parent
6422ec3783
commit
f5f788bc59
|
@ -216,18 +216,29 @@ func update_block_confirm(gbt *GbtAlphContext) {
|
|||
if checkResult {
|
||||
blockInfo := gbt.GbtCtx.ClientAlphApi.GetBlcokInfo(blockHash)
|
||||
var total_amount float64 = 0
|
||||
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
|
||||
if len(input) == 0 {
|
||||
for v := range output {
|
||||
address, amount := output[v].Address, output[v].AttoAlphAmount
|
||||
if address == addr[fromGroup] && nonce == block.Nonce {
|
||||
fromGroup, toGroup, nonce, height := blockInfo.ChainFrom, blockInfo.ChainTo, blockInfo.Nonce, blockInfo.Height
|
||||
for _, tx := range blockInfo.Transactions {
|
||||
for _, out := range tx.Unsigned.FixedOutputs {
|
||||
if out.Address == addr[fromGroup] && nonce == blockInfo.Nonce {
|
||||
amount := out.AttoAlphAmount
|
||||
total_amount += savePoint4(stringToFloat64(amount) / math.Pow(10, 18))
|
||||
fmt.Println(fromGroup, "->", toGroup, "(", height, "):", total_amount, ",", nonce, " ", blockHash, " ", address, " 报块成功")
|
||||
fmt.Println(fromGroup, "->", toGroup, "(", height, "):", total_amount, ",", nonce, " ", blockHash, " ", out.Address, " 报块成功")
|
||||
} else {
|
||||
fmt.Println(fromGroup, "->", toGroup, "(", height, "):", total_amount, ",", nonce, "不是报块,实际报块地址为:", address)
|
||||
fmt.Println(fromGroup, "->", toGroup, "(", height, "):", total_amount, ",", nonce, "不是报块,实际报块地址为:", out.Address)
|
||||
}
|
||||
}
|
||||
}
|
||||
// if len(input) == 0 {
|
||||
// for v := range output {
|
||||
// address, amount := output[v].Address, output[v].AttoAlphAmount
|
||||
// if address == addr[fromGroup] && nonce == block.Nonce {
|
||||
// total_amount += savePoint4(stringToFloat64(amount) / math.Pow(10, 18))
|
||||
// fmt.Println(fromGroup, "->", toGroup, "(", height, "):", total_amount, ",", nonce, " ", blockHash, " ", address, " 报块成功")
|
||||
// } else {
|
||||
// fmt.Println(fromGroup, "->", toGroup, "(", height, "):", total_amount, ",", nonce, "不是报块,实际报块地址为:", address)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
block_height := int64(block.Height)
|
||||
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))
|
||||
|
|
Loading…
Reference in New Issue