X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=db.py;h=7f1ea354d70cdf8ca1d2e5e4fd6c6a4fee50d5b9;hb=4cbe19b1daad36df75621e558fa6a53eb8d9467b;hp=e75ca54e1c84f479baac89198f8fd29fca5c43a5;hpb=5531211cfaa147f4122932e7bc80df2516d714d3;p=electrum-server.git diff --git a/db.py b/db.py index e75ca54..7f1ea35 100644 --- a/db.py +++ b/db.py @@ -1,3 +1,20 @@ +#!/usr/bin/env python +# Copyright(C) 2012 thomasv@gitorious + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . + from Abe.abe import hash_to_address, decode_check_address from Abe.DataStore import DataStore as Datastore_class from Abe import DataStore, readconf, BCDataStream, deserialize, util, base58 @@ -323,6 +340,20 @@ class MyStore(Datastore_class): store.commit() + + def send_tx(self,tx): + postdata = dumps({"method": 'importtransaction', 'params': [tx], 'id':'jsonrpc'}) + respdata = urllib.urlopen(self.bitcoind_url, postdata).read() + r = loads(respdata) + if r['error'] != None: + out = "error: transaction rejected by memorypool\n"+tx + else: + out = r['result'] + return out + + + + def main_iteration(store): try: dblock.acquire()