Fix network diff adjustment prediction algo
This commit is contained in:
5 files changed
+186
-28
No files matched your search
@@ -205,6 +205,24 @@ func (c *RPC) GetBlockHash(ctx context.Context, height int64) (string, error) {
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// BlockHeader is the subset of `getblockheader <hash>` we care about.
|
||||
type BlockHeader struct {
|
||||
Hash string `json:"hash"`
|
||||
Height int64 `json:"height"`
|
||||
Time int64 `json:"time"`
|
||||
}
|
||||
|
||||
// GetBlockHeader returns a block's header. Preferred over GetBlock when
|
||||
// only header fields are needed: getblock at verbosity 2 expands every
|
||||
// transaction in the block, which for a full block is megabytes of JSON.
|
||||
func (c *RPC) GetBlockHeader(ctx context.Context, hash string) (*BlockHeader, error) {
|
||||
var out BlockHeader
|
||||
if err := c.Call(ctx, "getblockheader", []any{hash, true}, &out); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
// BlockVerbose2 is the subset of `getblock <hash> 2` we care about.
|
||||
// Verbosity 2 expands each tx into its full object so we can read the
|
||||
// coinbase output values without a second getrawtransaction call.
|
||||
|
||||
Reference in new issue
Block a user