mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-07 14:54:15 +00:00
mark didn't really make a mark
This commit is contained in:
parent
b303d77029
commit
a22cc7f698
@ -293,16 +293,15 @@ public class BitcoinSerializer {
|
|||||||
|
|
||||||
// The command is a NULL terminated string, unless the command fills all twelve bytes
|
// The command is a NULL terminated string, unless the command fills all twelve bytes
|
||||||
// in which case the termination is implicit.
|
// in which case the termination is implicit.
|
||||||
int mark = cursor;
|
for (; header[cursor] != 0 && cursor < COMMAND_LEN; cursor++) ;
|
||||||
for (; header[cursor] != 0 && cursor - mark < COMMAND_LEN; cursor++) ;
|
byte[] commandBytes = new byte[cursor];
|
||||||
byte[] commandBytes = new byte[cursor - mark];
|
System.arraycopy(header, 0, commandBytes, 0, cursor);
|
||||||
System.arraycopy(header, mark, commandBytes, 0, cursor - mark);
|
|
||||||
try {
|
try {
|
||||||
command = new String(commandBytes, "US-ASCII");
|
command = new String(commandBytes, "US-ASCII");
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
throw new RuntimeException(e); // Cannot happen.
|
throw new RuntimeException(e); // Cannot happen.
|
||||||
}
|
}
|
||||||
cursor = mark + COMMAND_LEN;
|
cursor = COMMAND_LEN;
|
||||||
|
|
||||||
size = (int) readUint32(header, cursor);
|
size = (int) readUint32(header, cursor);
|
||||||
cursor += 4;
|
cursor += 4;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user