FindoraNetwork / platform

Official Implementation of Findora Network.
https://findora.org
Other
73 stars 29 forks source link

Fix the situation that the field pubkey_sign_map in the transaction structure will be out of order #892

Closed malefooo closed 1 year ago

malefooo commented 1 year ago

New transaction structure body v1 version, the data structure of the field pubkey_sign_map is changed from HashMap to BtreeMap

pub struct TransactionV1 {
    pub body: TransactionBody,
    pub signatures: Vec<SignatureOf<TransactionBody>>,
    pub pubkey_sign_map: BTreeMap<XfrPublicKey, SignatureOf<TransactionBody>>,
}

The logic of the fix is as follows

  1. create a new checkpoint fix_tx_sign_map_disorder
  2. update txn_merkle when update_state, and use TransactionV1 to replace the previous data structure to generate the hash when the checkpoint is reached
  3. when updating txns_in_block_hash, when the checkpoint is reached, use the list constructed by TransactionV1 to generate the hash instead of the previous data structure list