Stricter compliance to old API
This commit is contained in:
parent
2cdc16a9f8
commit
4f1c4acbe5
|
@ -283,7 +283,7 @@ func main() {
|
|||
Id: block.Id,
|
||||
Height: block.Height,
|
||||
Timestamp: block.Timestamp,
|
||||
Weight: block.Difficulty,
|
||||
Weight: block.Difficulty.Lo,
|
||||
}
|
||||
|
||||
for u := range api.GetDatabase().GetUnclesByParentId(block.Id) {
|
||||
|
@ -291,9 +291,9 @@ func main() {
|
|||
s.Uncles = append(s.Uncles, sharesInWindowResultUncle{
|
||||
Id: u.Block.Id,
|
||||
Height: u.Block.Height,
|
||||
Weight: types.Difficulty{Uint128: uncleWeight},
|
||||
Weight: uncleWeight.Lo,
|
||||
})
|
||||
s.Weight.Uint128 = s.Weight.Add(uncleWeight)
|
||||
s.Weight += uncleWeight.Lo
|
||||
}
|
||||
|
||||
result = append(result, s)
|
||||
|
@ -308,7 +308,7 @@ func main() {
|
|||
Id: uncle.Block.Id,
|
||||
Height: uncle.Block.Height,
|
||||
Timestamp: uncle.Block.Timestamp,
|
||||
Weight: types.Difficulty{Uint128: uncle.Block.Difficulty.Mul64(100 - p2pool.UnclePenalty).Div64(100)},
|
||||
Weight: uncle.Block.Difficulty.Mul64(100 - p2pool.UnclePenalty).Div64(100).Lo,
|
||||
}
|
||||
result = append(result, s)
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ func MapJSONBlock(api *api.Api, block database.BlockInterface, extraUncleData, e
|
|||
}
|
||||
|
||||
weight := b.Difficulty
|
||||
b.Uncles = make([]any, 0)
|
||||
|
||||
if uncle, ok := block.(*database.UncleBlock); ok {
|
||||
b.Parent = &database.JSONBlockParent{
|
||||
|
|
|
@ -60,7 +60,7 @@ type sharesInWindowResult struct {
|
|||
Id types.Hash `json:"id"`
|
||||
Height uint64 `json:"height"`
|
||||
Timestamp uint64 `json:"timestamp"`
|
||||
Weight types.Difficulty `json:"weight"`
|
||||
Weight uint64 `json:"weight"`
|
||||
Uncles []sharesInWindowResultUncle `json:"uncles,omitempty"`
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ type sharesInWindowResultParent struct {
|
|||
}
|
||||
|
||||
type sharesInWindowResultUncle struct {
|
||||
Id types.Hash `json:"id"`
|
||||
Height uint64 `json:"height"`
|
||||
Weight types.Difficulty `json:"weight"`
|
||||
Id types.Hash `json:"id"`
|
||||
Height uint64 `json:"height"`
|
||||
Weight uint64 `json:"weight"`
|
||||
}
|
||||
|
|
|
@ -96,12 +96,12 @@ type Block struct {
|
|||
//Lock extra JSON field, do not use
|
||||
Lock sync.Mutex `json:"-"`
|
||||
|
||||
//Weight extra JSON field, do not use
|
||||
Weight uint64 `json:"weight"`
|
||||
//Parent extra JSON field, do not use
|
||||
Parent *JSONBlockParent `json:"parent,omitempty"`
|
||||
//Uncles extra JSON field, do not use
|
||||
Uncles []any `json:"uncles,omitempty"`
|
||||
Uncles []any `json:"uncles"`
|
||||
//Weight extra JSON field, do not use
|
||||
Weight uint64 `json:"weight"`
|
||||
|
||||
//Orphan extra JSON field, do not use
|
||||
Orphan bool `json:"orphan,omitempty"`
|
||||
|
|
|
@ -730,7 +730,7 @@ type Payout struct {
|
|||
Height uint64 `json:"height"`
|
||||
} `json:"main"`
|
||||
Timestamp uint64 `json:"timestamp"`
|
||||
Uncle bool `json:"uncle"`
|
||||
Uncle bool `json:"uncle,omitempty"`
|
||||
Coinbase struct {
|
||||
Id types.Hash `json:"id"`
|
||||
Reward uint64 `json:"reward"`
|
||||
|
|
Loading…
Reference in a new issue