File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 104104import org .tron .core .services .WitnessService ;
105105import org .tron .core .witness .ProposalController ;
106106import org .tron .core .witness .WitnessController ;
107+ import org .tron .core .zen .merkle .IncrementalMerkleTreeCapsule ;
108+ import org .tron .core .zen .merkle .IncrementalMerkleTreeContainer ;
107109import org .tron .core .zen .merkle .IncrementalMerkleTreeStore ;
108110import org .tron .core .zen .merkle .IncrementalMerkleVoucherStore ;
109111import org .tron .core .zen .merkle .MerkleContainer ;
@@ -483,6 +485,11 @@ public void init() {
483485 if (Args .getInstance ().isNeedToUpdateAsset () && needToUpdateAsset ()) {
484486 new AssetUpdateHelper (this ).doWork ();
485487 }
488+
489+ if (Args .getInstance ().getAllowZKSnarkTransaction () == 1 ) {
490+ merkleTreeStore .addEmptyTree ();
491+ }
492+
486493 initCacheTxs ();
487494 revokingStore .enable ();
488495 validateSignService = Executors
Original file line number Diff line number Diff line change @@ -206,6 +206,7 @@ public void setDynamicParameters(ProposalCapsule proposalCapsule) {
206206 case (24 ): {
207207 if ( manager .getDynamicPropertiesStore ().getAllowZksnarkTransaction () == 0 ) {
208208 manager .getDynamicPropertiesStore ().saveAllowZksnarkTransaction (entry .getValue ());
209+ manager .getMerkleTreeStore ().addEmptyTree ();
209210 }
210211 break ;
211212 }
Original file line number Diff line number Diff line change 44import org .springframework .beans .factory .annotation .Autowired ;
55import org .springframework .beans .factory .annotation .Value ;
66import org .springframework .stereotype .Component ;
7+ import org .tron .core .db .Manager ;
78import org .tron .core .db .TronStoreWithRevoking ;
89
910@ Component
@@ -25,4 +26,11 @@ public boolean contain(byte[] key) {
2526 byte [] value = revokingDB .getUnchecked (key );
2627 return !ArrayUtils .isEmpty (value );
2728 }
29+
30+ public void addEmptyTree (){
31+ IncrementalMerkleTreeContainer container =
32+ (new IncrementalMerkleTreeCapsule ()).toMerkleTreeContainer ();
33+
34+ put (container .getMerkleTreeKey (), container .getTreeCapsule ());
35+ }
2836}
Original file line number Diff line number Diff line change @@ -40,14 +40,6 @@ public IncrementalMerkleTreeContainer getBestMerkle() {
4040 IncrementalMerkleTreeContainer container =
4141 (new IncrementalMerkleTreeCapsule ()).toMerkleTreeContainer ();
4242
43- // tmp
44- String s1 = "2ec45f5ae2d1bc7a80df02abfb2814a1239f956c6fb3ac0e112c008ba2c1ab91" ;
45- PedersenHashCapsule compressCapsule1 = new PedersenHashCapsule ();
46- compressCapsule1 .setContent (ByteString .copyFrom (ByteArray .fromHexString (s1 )));
47- PedersenHash a = compressCapsule1 .getInstance ();
48-
49- container .append (a );
50-
5143 this .manager
5244 .getMerkleTreeStore ()
5345 .put (container .getMerkleTreeKey (), container .getTreeCapsule ());
Original file line number Diff line number Diff line change 1919import org .tron .core .services .http .FullNodeHttpApiService ;
2020import org .tron .core .services .interfaceOnSolidity .RpcApiServiceOnSolidity ;
2121import org .tron .core .services .interfaceOnSolidity .http .solidity .HttpApiOnSolidityService ;
22+ import org .tron .core .zen .merkle .IncrementalMerkleTreeCapsule ;
23+ import org .tron .core .zen .merkle .IncrementalMerkleTreeContainer ;
2224
2325@ Slf4j (topic = "app" )
2426public class FullNode {
You can’t perform that action at this time.
0 commit comments