|
|
@ -1,6 +1,7 @@ |
|
|
|
package hmyapi |
|
|
|
package hmyapi |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
|
|
|
|
"encoding/hex" |
|
|
|
"math/big" |
|
|
|
"math/big" |
|
|
|
"time" |
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
|
@ -54,6 +55,8 @@ type HeaderInformation struct { |
|
|
|
Epoch uint64 `json:"epoch"` |
|
|
|
Epoch uint64 `json:"epoch"` |
|
|
|
Timestamp string `json:"timestamp"` |
|
|
|
Timestamp string `json:"timestamp"` |
|
|
|
UnixTime uint64 `json:"unixtime"` |
|
|
|
UnixTime uint64 `json:"unixtime"` |
|
|
|
|
|
|
|
LastCommitSig string `json:"lastCommitSig"` |
|
|
|
|
|
|
|
LastCommitBitmap string `json:"lastCommitBitmap"` |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func newHeaderInformation(header *block.Header) *HeaderInformation { |
|
|
|
func newHeaderInformation(header *block.Header) *HeaderInformation { |
|
|
@ -69,7 +72,10 @@ func newHeaderInformation(header *block.Header) *HeaderInformation { |
|
|
|
Epoch: header.Epoch().Uint64(), |
|
|
|
Epoch: header.Epoch().Uint64(), |
|
|
|
UnixTime: header.Time().Uint64(), |
|
|
|
UnixTime: header.Time().Uint64(), |
|
|
|
Timestamp: time.Unix(header.Time().Int64(), 0).UTC().String(), |
|
|
|
Timestamp: time.Unix(header.Time().Int64(), 0).UTC().String(), |
|
|
|
|
|
|
|
LastCommitBitmap: hex.EncodeToString(header.LastCommitBitmap()), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
sig := header.LastCommitSignature() |
|
|
|
|
|
|
|
result.LastCommitSig = hex.EncodeToString(sig[:]) |
|
|
|
return result |
|
|
|
return result |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|