コード例 #1
0
        public void DeleteBlock(string blockHash)
        {
            SyncBlockInfo block = BlockGetByHash(blockHash);

            // delete the outputs
            FilterDefinition <MapTransactionAddress> addrFilter = Builders <MapTransactionAddress> .Filter.Eq(addr => addr.BlockIndex, block.BlockIndex);

            MapTransactionAddress.DeleteMany(addrFilter);

            // delete the transaction
            FilterDefinition <MapTransactionBlock> transactionFilter = Builders <MapTransactionBlock> .Filter.Eq(info => info.BlockIndex, block.BlockIndex);

            MapTransactionBlock.DeleteMany(transactionFilter);

            // delete the block itself.
            FilterDefinition <MapBlock> blockFilter = Builders <MapBlock> .Filter.Eq(info => info.BlockHash, blockHash);

            MapBlock.DeleteOne(blockFilter);
        }