SHA256
fix: считать шаг линии через lineStep перед AddBlock
This commit is contained in:
+3
-1
@@ -179,7 +179,7 @@ final class ChannelsReadSupport {
|
||||
static List<PostBlock> channelPosts(Connection c, String ownerBch, int lineCode, int limit, boolean asc) throws SQLException {
|
||||
String order = asc ? "ASC" : "DESC";
|
||||
String sql = """
|
||||
SELECT login,bch_name,block_number,block_hash,block_bytes,to_bch_name,to_block_number,to_block_hash,msg_sub_type
|
||||
SELECT login,bch_name,block_number,block_hash,block_bytes,to_bch_name,to_block_number,to_block_hash,msg_sub_type,this_line_number
|
||||
FROM blocks
|
||||
WHERE bch_name=? AND msg_type=? AND msg_sub_type IN (?, ?) AND line_code=?
|
||||
ORDER BY block_number
|
||||
@@ -204,6 +204,7 @@ final class ChannelsReadSupport {
|
||||
pb.toBlockNumber = (Integer) rs.getObject("to_block_number");
|
||||
pb.toBlockHash = rs.getBytes("to_block_hash");
|
||||
pb.msgSubType = rs.getInt("msg_sub_type");
|
||||
pb.thisLineNumber = (Integer) rs.getObject("this_line_number");
|
||||
out.add(pb);
|
||||
}
|
||||
return out;
|
||||
@@ -513,6 +514,7 @@ final class ChannelsReadSupport {
|
||||
Integer toBlockNumber;
|
||||
byte[] toBlockHash;
|
||||
int msgSubType;
|
||||
Integer thisLineNumber;
|
||||
}
|
||||
|
||||
static final class TextInfo {
|
||||
|
||||
+1
@@ -100,6 +100,7 @@ public class Net_GetChannelMessages_Handler implements JsonMessageHandler {
|
||||
item.setMsgSubType(post.msgSubType);
|
||||
item.setAuthorLogin(post.login);
|
||||
item.setAuthorBlockchainName(post.bchName);
|
||||
item.setLineStep(post.thisLineNumber);
|
||||
item.setTargetBlockchainName(post.toBchName);
|
||||
item.setTargetBlockNumber(post.toBlockNumber);
|
||||
item.setTargetBlockHash(ChannelsReadSupport.toHex(post.toBlockHash));
|
||||
|
||||
+6
-3
@@ -85,7 +85,7 @@ public class Net_GetMessageThread_Handler implements JsonMessageHandler {
|
||||
|
||||
private List<PostRow> findReplies(Connection c, String toBchName, int toBlockNumber, byte[] toBlockHash, int limit) throws Exception {
|
||||
String sql = """
|
||||
SELECT login,bch_name,block_number,block_hash,block_bytes,to_bch_name,to_block_number,to_block_hash,line_code,msg_sub_type
|
||||
SELECT login,bch_name,block_number,block_hash,block_bytes,to_bch_name,to_block_number,to_block_hash,line_code,msg_sub_type,this_line_number
|
||||
FROM blocks
|
||||
WHERE msg_type=1 AND msg_sub_type=?
|
||||
AND to_bch_name=? AND to_block_number=? AND to_block_hash=?
|
||||
@@ -108,7 +108,7 @@ public class Net_GetMessageThread_Handler implements JsonMessageHandler {
|
||||
|
||||
private PostRow findByNumber(Connection c, String bchName, int blockNumber) throws Exception {
|
||||
String sql = """
|
||||
SELECT login,bch_name,block_number,block_hash,block_bytes,to_bch_name,to_block_number,to_block_hash,line_code,msg_sub_type
|
||||
SELECT login,bch_name,block_number,block_hash,block_bytes,to_bch_name,to_block_number,to_block_hash,line_code,msg_sub_type,this_line_number
|
||||
FROM blocks
|
||||
WHERE bch_name=? AND block_number=?
|
||||
LIMIT 1
|
||||
@@ -134,6 +134,7 @@ public class Net_GetMessageThread_Handler implements JsonMessageHandler {
|
||||
row.toBlockHash = rs.getBytes("to_block_hash");
|
||||
row.lineCode = (Integer) rs.getObject("line_code");
|
||||
row.msgSubType = rs.getInt("msg_sub_type");
|
||||
row.thisLineNumber = (Integer) rs.getObject("this_line_number");
|
||||
return row;
|
||||
}
|
||||
|
||||
@@ -146,6 +147,7 @@ public class Net_GetMessageThread_Handler implements JsonMessageHandler {
|
||||
node.setMsgSubType(row.msgSubType);
|
||||
node.setAuthorLogin(row.login);
|
||||
node.setAuthorBlockchainName(row.bchName);
|
||||
node.setLineStep(row.thisLineNumber);
|
||||
node.setTargetBlockchainName(row.toBchName);
|
||||
node.setTargetBlockNumber(row.toBlockNumber);
|
||||
node.setTargetBlockHash(ChannelsReadSupport.toHex(row.toBlockHash));
|
||||
@@ -199,7 +201,7 @@ public class Net_GetMessageThread_Handler implements JsonMessageHandler {
|
||||
|
||||
private List<PostRow> findEdits(Connection c, String bch, int targetBlock, byte[] targetHash, int subType) throws Exception {
|
||||
String sql = """
|
||||
SELECT login,bch_name,block_number,block_hash,block_bytes,to_bch_name,to_block_number,to_block_hash,line_code,msg_sub_type
|
||||
SELECT login,bch_name,block_number,block_hash,block_bytes,to_bch_name,to_block_number,to_block_hash,line_code,msg_sub_type,this_line_number
|
||||
FROM blocks
|
||||
WHERE bch_name=? AND msg_type=1 AND msg_sub_type=?
|
||||
AND to_block_number=? AND to_block_hash=?
|
||||
@@ -231,5 +233,6 @@ public class Net_GetMessageThread_Handler implements JsonMessageHandler {
|
||||
byte[] toBlockHash;
|
||||
Integer lineCode;
|
||||
int msgSubType;
|
||||
Integer thisLineNumber;
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -52,6 +52,7 @@ public class Net_GetChannelMessages_Response extends Net_Response {
|
||||
private Integer msgSubType;
|
||||
private String authorLogin;
|
||||
private String authorBlockchainName;
|
||||
private Integer lineStep;
|
||||
private String targetBlockchainName;
|
||||
private Integer targetBlockNumber;
|
||||
private String targetBlockHash;
|
||||
@@ -74,6 +75,9 @@ public class Net_GetChannelMessages_Response extends Net_Response {
|
||||
public String getAuthorBlockchainName() { return authorBlockchainName; }
|
||||
public void setAuthorBlockchainName(String authorBlockchainName) { this.authorBlockchainName = authorBlockchainName; }
|
||||
|
||||
public Integer getLineStep() { return lineStep; }
|
||||
public void setLineStep(Integer lineStep) { this.lineStep = lineStep; }
|
||||
|
||||
public String getTargetBlockchainName() { return targetBlockchainName; }
|
||||
public void setTargetBlockchainName(String targetBlockchainName) { this.targetBlockchainName = targetBlockchainName; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user