File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 39
39
import pickle
40
40
import math
41
41
from electrumx .lib .hash import sha256 , double_sha256
42
- from cbor2 import dumps , loads , CBORDecodeError
42
+ from cbor2 import dumps , loads , CBORDecodeError , CBORTag
43
43
from collections .abc import Mapping
44
44
from functools import reduce
45
45
from merkletools import MerkleTools
@@ -1290,15 +1290,19 @@ def auto_encode_bytes_elements(state):
1290
1290
'$len' : sys .getsizeof (state ),
1291
1291
'$auto' : True
1292
1292
}
1293
+
1294
+ if isinstance (state , CBORTag ):
1295
+ return dumps (state )
1296
+
1293
1297
if not isinstance (state , dict ) and not isinstance (state , list ):
1294
1298
return state
1295
1299
1296
1300
if isinstance (state , list ):
1297
1301
reformatted_list = []
1298
1302
for item in state :
1299
1303
reformatted_list .append (auto_encode_bytes_elements (item ))
1300
- return reformatted_list
1301
-
1304
+ return reformatted_list
1305
+
1302
1306
for key , value in state .items ():
1303
1307
state [key ] = auto_encode_bytes_elements (value )
1304
1308
return state
You can’t perform that action at this time.
0 commit comments