pub fn delete<D: DatabaseHandle>(
    root: H256, database: &D, key: &[u8]
) -> (H256, Change) {
    let mut change = Change::default();
    let nibble = nibble::from_key(key);

    let (new, subchange) = if root == empty_trie_hash!() {
        return (root, change)
    } else {
        let old = MerkleNode::decode(&Rlp::new(database.get(root)));
        change.remove_raw(root);
        delete::delete_by_node(old, nibble, database)
    };
    change.merge(&subchange);

    match new {
        Some(new) => {
            change.add_node(&new);

            let hash = H256::from(Keccak256::digest(&rlp::encode(&new).to_vec()).as_slice());
            (hash, change)
        },
        None => {
            (empty_trie_hash!(), change)
        },
    }
}
/// Delete a key from a markle trie. Return the new root hash and the
/// changes.
Delete a key from a markle trie. Return the new root hash and the
changes.
Delete a key from a markle trie . Return the new root hash and the changes .
pub fn delete<D: DatabaseHandle>(
    root: H256, database: &D, key: &[u8]
) -> (H256, Change) {
    let mut change = Change::default();
    let nibble = nibble::from_key(key);
    let (new, subchange) = if root == empty_trie_hash!() {
        return (root, change)
    } else {
        let old = MerkleNode::decode(&Rlp::new(database.get(root)));
        change.remove_raw(root);
        delete::delete_by_node(old, nibble, database)
    };
    change.merge(&subchange);
    match new {
        Some(new) => {
            change.add_node(&new);
            let hash = H256::from(Keccak256::digest(&rlp::encode(&new).to_vec()).as_slice());
            (hash, change)
        },
        None => {
            (empty_trie_hash!(), change)
        },
    }
}
pub fn delete < D : DatabaseHandle > ( root : H256 , database : & D , key : & [ u8 ] ) -> ( H256 , Change ) { let mut change = Change :: default ( ) ; let nibble = nibble :: from_key ( key ) ; let ( new , subchange ) = if root == empty_trie_hash ! ( ) { return ( root , change ) } else { let old = MerkleNode :: decode ( & Rlp :: new ( database . get ( root ) ) ) ; change . remove_raw ( root ) ; delete :: delete_by_node ( old , nibble , database ) } ; change . merge ( & subchange ) ; match new { Some ( new ) => { change . add_node ( & new ) ; let hash = H256 :: from ( Keccak256 :: digest ( & rlp :: encode ( & new ) . to_vec ( ) ) . as_slice ( ) ) ; ( hash , change ) } , None => { ( empty_trie_hash ! ( ) , change ) } , } }
Delete a key from a markle trie.
Delete a key from a markle trie .
root
H256
database
&D
key
&[u8]