remove bccapi things; move send_tx to backend
[electrum-server.git] / db.py
diff --git a/db.py b/db.py
index e75ca54..7f1ea35 100644 (file)
--- 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
+# <http://www.gnu.org/licenses/agpl.html>.
+
 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()