more explicity payload err and msg

This commit is contained in:
Ian Norden
2020-02-23 17:15:26 -06:00
parent 2fbf97da9d
commit 94aefafd7c
14 changed files with 88 additions and 40 deletions
+10
View File
@@ -38,6 +38,11 @@ type IPLDPayload struct {
StorageNodes map[common.Hash][]TrieNode
}
// Height satisfies the StreamedIPLDs interface
func (i IPLDPayload) Height() int64 {
return i.Block.Number().Int64()
}
// Trie struct used to flag node as leaf or not
type TrieNode struct {
Key common.Hash
@@ -99,6 +104,11 @@ type StreamResponse struct {
err error
}
// Height satisfies the ServerResponse interface
func (sr StreamResponse) Height() int64 {
return sr.BlockNumber.Int64()
}
func (sr *StreamResponse) ensureEncoded() {
if sr.encoded == nil && sr.err == nil {
sr.encoded, sr.err = json.Marshal(sr)