Skip to content

Cache nonexsistent key in datacache #1600

@Qiao-Jin

Description

@Qiao-Jin

It seems we forget to cache non-existent key in data cache. If a non-existent key is searched multiple times in a snapshot cache during a block period, currently every time it would be searched in levelDB, which can be very time consuming.
If we have a set in data cache which includes non-existent keys which have been confirmed in current snapshot, above occasions would be avoided.

I.e. each time handling a transfer during block persisting, we will check the payable status of the transfer destination:

ContractState contract_to = engine.Snapshot.Contracts.TryGet(to);

Address contract is not stored in levelDB, and non-existent record is currently not recorded. So every time the tryget will lead to a levelDB search, even if the searched scripthash has been searched before within current snapshot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DiscussionInitial issue state - proposed but not yet accepted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions