Skip to content

Commit 0744d0c

Browse files
Node RPC: add raw mempool operations
1 parent b08ce66 commit 0744d0c

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

node/data.go

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,21 @@ type MempoolResponse struct {
3838

3939
// Applied -
4040
type Applied struct {
41-
Hash string `json:"hash"`
42-
Branch string `json:"branch"`
43-
Signature string `json:"signature"`
44-
Contents []Content `json:"contents"`
41+
Hash string `json:"hash"`
42+
Branch string `json:"branch"`
43+
Signature string `json:"signature"`
44+
Contents []Content `json:"contents"`
45+
Raw stdJSON.RawMessage `json:"raw"`
46+
}
47+
48+
// UnmarshalJSON -
49+
func (a *Applied) UnmarshalJSON(data []byte) error {
50+
type buf Applied
51+
if err := json.Unmarshal(data, (*buf)(a)); err != nil {
52+
return err
53+
}
54+
a.Raw = data
55+
return nil
4556
}
4657

4758
// Failed -
@@ -52,6 +63,7 @@ type Failed struct {
5263
Contents []Content `json:"contents"`
5364
Signature string `json:"signature"`
5465
Error stdJSON.RawMessage `json:"error,omitempty"`
66+
Raw stdJSON.RawMessage `json:"raw"`
5567
}
5668

5769
// UnmarshalJSON -
@@ -67,7 +79,11 @@ func (f *Failed) UnmarshalJSON(data []byte) error {
6779
return err
6880
}
6981
type buf Failed
70-
return json.Unmarshal(body[1], (*buf)(f))
82+
if err := json.Unmarshal(body[1], (*buf)(f)); err != nil {
83+
return err
84+
}
85+
f.Raw = data
86+
return nil
7187
}
7288

7389
// Contents -

0 commit comments

Comments
 (0)