# Path: reversecoin/exceptions.py
# class BitcoinException(Exception):
# class InsufficientBalanceException(BitcoinException):
# class AmountTooLargeException(BitcoinException):
# class VaultAlreadyExistsException(BitcoinException):


import string
import cStringIO
import leveldb
import sqlite3
import io
import os
import time
import utils
import binascii
import shutil
import logging
from decimal import Decimal
from cache import Cache
from common import *
from bitcoin.serialize import *
from bitcoin.core import *
from bitcoin import core
from bitcoin.messages import msg_block, message_to_str, message_read
from bitcoin.coredefs import COIN
from bitcoin.scripteval import VerifySignature
from bitcoin import serialize
from bitcoin.script import OP_VAULT_WITHDRAW, OP_VAULT_FAST_WITHDRAW, OP_VAULT_CONFIRM, OP_VAULT_OVERRIDE
from reversecoin import exceptions
        except exceptions.InsufficientBalanceException as e:
            return None

        tx.calc_sha256()
        if self.mempool.add(tx):
            self.logger.debug("Adding to vault: %064x" % tx.sha256)
            return vault_address
        return None

    def withdrawfromvault(self, fromaddress, toaddress, amount):
        tx = self.wallet.withdrawfromvault(fromaddress, toaddress, amount)
        if tx and self.mempool.add(tx):
            return amount
        return 0

    def fastwithdrawfromvault(self, fromaddress, toaddress, amount):
        tx = self.wallet.fastwithdrawfromvault(fromaddress, toaddress, amount)
        if tx and self.mempool.add(tx):
            return amount
        return 0

    def overridevaulttx(self, fromvault, toaddress):
        amount, tx = self.wallet.overridevaulttx(fromvault, toaddress)
        if tx and self.mempool.add(tx):
            return amount
        return 0

    def listreceivedbyaddress(self, address):
        txouts = {}
        end_height = self.getheight()

# Path: reversecoin/exceptions.py
# class BitcoinException(Exception):
# class InsufficientBalanceException(BitcoinException):
# class AmountTooLargeException(BitcoinException):
# class VaultAlreadyExistsException(BitcoinException):


# Path: reversecoin/chaindb.py
import string
import cStringIO
import leveldb
import sqlite3
import io
import os
import time
import utils
import binascii
import shutil
import logging
from decimal import Decimal
from cache import Cache
from common import *
from bitcoin.serialize import *
from bitcoin.core import *
from bitcoin import core
from bitcoin.messages import msg_block, message_to_str, message_read
from bitcoin.coredefs import COIN
from bitcoin.scripteval import VerifySignature
from bitcoin import serialize
from bitcoin.script import OP_VAULT_WITHDRAW, OP_VAULT_FAST_WITHDRAW, OP_VAULT_CONFIRM, OP_VAULT_OVERRIDE
from reversecoin import exceptions

        except exceptions.InsufficientBalanceException as e:
            return None

        tx.calc_sha256()
        if self.mempool.add(tx):
            self.logger.debug("Adding to vault: %064x" % tx.sha256)
            return vault_address
        return None

    def withdrawfromvault(self, fromaddress, toaddress, amount):
        tx = self.wallet.withdrawfromvault(fromaddress, toaddress, amount)
        if tx and self.mempool.add(tx):
            return amount
        return 0

    def fastwithdrawfromvault(self, fromaddress, toaddress, amount):
        tx = self.wallet.fastwithdrawfromvault(fromaddress, toaddress, amount)
        if tx and self.mempool.add(tx):
            return amount
        return 0

    def overridevaulttx(self, fromvault, toaddress):
        amount, tx = self.wallet.overridevaulttx(fromvault, toaddress)
        if tx and self.mempool.add(tx):
            return amount
        return 0

    def listreceivedbyaddress(self, address):
        txouts = {}
        end_height = self.getheight()

        public_key_hash = utils.address_to_public_key_hash(address)