Skip to content

Commit d49a53d

Browse files
committed
Set all child nodes as dirty when decoding
1 parent 37c3d46 commit d49a53d

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

internal/trie/node/decode.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ func decodeBranch(reader io.Reader, variant byte, partialKeyLength uint16) (
9797
const hashLength = 32
9898
childNode := &Node{
9999
HashDigest: hash,
100+
Dirty: true,
100101
}
101102
if len(hash) < hashLength {
102103
// Handle inlined nodes

internal/trie/node/decode_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ func Test_decodeBranch(t *testing.T) {
234234
nil, nil, nil, nil, nil,
235235
{
236236
HashDigest: []byte{1, 2, 3, 4, 5},
237+
Dirty: true,
237238
},
238239
}),
239240
Dirty: true,
@@ -272,6 +273,7 @@ func Test_decodeBranch(t *testing.T) {
272273
nil, nil, nil, nil, nil,
273274
{
274275
HashDigest: []byte{1, 2, 3, 4, 5},
276+
Dirty: true,
275277
},
276278
}),
277279
Dirty: true,

internal/trie/node/encode_decode_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ func Test_Branch_Encode_Decode(t *testing.T) {
9393
14, 15, 16, 17,
9494
10, 11, 12, 13,
9595
},
96+
Dirty: true,
9697
},
9798
}),
9899
},
@@ -109,6 +110,7 @@ func Test_Branch_Encode_Decode(t *testing.T) {
109110
21, 186, 226, 204, 145,
110111
132, 5, 39, 204,
111112
},
113+
Dirty: true,
112114
},
113115
}),
114116
Dirty: true,

0 commit comments

Comments
 (0)