Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 7f0f5de

Browse files
committed
cleanup
1 parent fcc9bbe commit 7f0f5de

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

pyethereum/apiserver.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,18 @@ def block(arg=None):
105105
if arg is None:
106106
return blocks()
107107
elif arg == 'head':
108-
block = chain_manager.head
108+
blk = chain_manager.head
109109
elif arg.isdigit():
110-
block = chain_manager.get(chain_manager.index.get_block_by_number(int(arg)))
110+
blk = chain_manager.get(chain_manager.index.get_block_by_number(int(arg)))
111111
else:
112112
try:
113113
h = arg.decode('hex')
114114
except TypeError:
115115
raise KeyError
116-
block = chain_manager.get(h)
116+
blk = chain_manager.get(h)
117117
except KeyError:
118-
return bottle.abort(404, 'No block %s' % arg)
119-
return make_blocks_response([block])
118+
return bottle.abort(404, 'Unknown Block %s' % arg)
119+
return make_blocks_response([blk])
120120

121121

122122
# ######## Transactions ############
@@ -132,13 +132,6 @@ def add_transaction():
132132
tx = Transaction.hex_deserialize(hex_data)
133133
signals.local_transaction_received.send(sender=None, transaction=tx)
134134
return bottle.redirect(base_url + '/transactions/' + tx.hex_hash())
135-
"""
136-
137-
HTTP status code 200 OK for a successful PUT of an update to an existing resource. No response body needed. (Per Section 9.6, 204 No Content is even more appropriate.)
138-
HTTP status code 201 Created for a successful PUT of a new resource, with URIs and metadata of the new resource echoed in the response body. (RFC 2616 Section 10.2.2)
139-
HTTP status code 409 Conflict for a PUT that is unsuccessful due to a 3rd-party modification, with a list of differences between the attempted update and the current resource in the response body. (RFC 2616 Section 10.4.10)
140-
HTTP status code 400 Bad Request for an unsuccessful PUT, with natural-language text (such as English) in the response body that explains why the PUT failed. (RFC 2616 Section 10.4)
141-
"""
142135

143136

144137
@app.get(base_url + '/transactions/<arg>')
@@ -158,7 +151,7 @@ def get_transactions(arg=None):
158151
txs = chain_manager.miner.get_transactions()
159152
found = [tx for tx in txs if tx.hex_hash() == arg]
160153
if not found:
161-
return bottle.abort(404, 'No Transaction %s' % arg)
154+
return bottle.abort(404, 'Unknown Transaction %s' % arg)
162155
tx, blk = found[0], chain_manager.miner.block
163156
# response
164157
tx = tx.to_dict()

0 commit comments

Comments
 (0)