peercoin / coinlib

The most feature-complete *coin library in the entire Dart/Flutter ecosystem.
BSD 3-Clause "New" or "Revised" License
6 stars 11 forks source link

Precomputed signature hash caching #21

Open MatthewLM opened 1 year ago

MatthewLM commented 1 year ago

The hashes from the new PrecomputeHasher sub-classes in the 9-tr-sighash branch can be cached for use across input signature hashes. A new PrecomputedSignatureHashes class can hold data for signature hashes and provide both double hashes (non-taproot) and single hashes (taproot).

The new cache objects can be carried by a Transaction and passed to the WitnessSignatureHasher and TaprootSignatureHasher classes. When a transaction is signed, the object can be passed to the new Transaction object to retain the cached signatures between signings. A new object can be constructed for new Transaction objects from the addInput() and addOutput methods with the invalidated hashes removed.

MatthewLM commented 1 year ago

PrecomputedSignatureHashes was created in 5fd4bf8daa4209d7ed5256b712253218b21e84aa but needs to be listed into Transaction to cache hashes between signings.