we can now build below existing blocks

This commit is contained in:
Crypto City 2019-12-10 20:15:35 +00:00
parent cefe06e359
commit 87b2d3e165
12 changed files with 112 additions and 72 deletions

View File

@ -104,11 +104,9 @@ bool cc_command_handler_build::check(const cryptonote::BlockchainDB &db, const c
MERROR("inconsistent tile height at " << x << " " << y << ": " << sz);
return false;
}
const uint16_t height = sz;
const uint16_t build_height = std::max(height, build.min_height);
if (decoded[idx])
{
items_needed[ITEM_LABOUR] += get_build_labour_cost_for_height(build_height);
items_needed[ITEM_LABOUR] += get_build_labour_cost_for_height(build.height);
++items_needed[decoded[idx]];
}
++idx;
@ -172,12 +170,16 @@ bool cc_command_handler_build::execute(cryptonote::BlockchainDB &db, const crypt
return false;
}
const uint16_t height = sz;
const uint16_t build_height = std::max(height, build.min_height);
if (decoded[idx])
{
while (tiles[tile_idx].size() < build_height)
if (sz > build.height && tiles[tile_idx][build.height] != 0)
{
MERROR("There is already a tile there");
return false;
}
while (tiles[tile_idx].size() <= build.height)
tiles[tile_idx].push_back(0);
tiles[tile_idx].push_back(decoded[idx]);
tiles[tile_idx][build.height] = decoded[idx];
++items_needed[decoded[idx]];
items_needed[ITEM_LABOUR] += cc::get_build_labour_cost_for_height(tiles[tile_idx].size() - 1);
}
@ -245,7 +247,6 @@ bool cc_command_handler_build::revert(cryptonote::BlockchainDB &db, const crypto
return false;
}
const uint16_t height = sz;
const uint16_t build_height = std::max(height, build.min_height);
if (decoded[idx])
{
if (sz == 0)
@ -253,13 +254,18 @@ bool cc_command_handler_build::revert(cryptonote::BlockchainDB &db, const crypto
MERROR("Cannot revert build from an empty tile");
return false;
}
if (tiles[tile_idx].back() != decoded[idx])
if (sz < build.height || tiles[tile_idx][build.height] == 0)
{
MERROR("Cannot revert build from an different block that what is expected: expected " << (unsigned)decoded[idx] << ", got " << (unsigned)tiles[idx].back());
MERROR("Cannot revert build as there is no block where one was expected");
return false;
}
tiles[tile_idx].pop_back();
items_needed[ITEM_LABOUR] += cc::get_build_labour_cost_for_height(tiles[tile_idx].size());
if (tiles[tile_idx][build.height] != decoded[idx])
{
MERROR("Cannot revert build from an different block that what is expected: expected " << (unsigned)decoded[idx] << ", got " << (unsigned)tiles[idx][build.height]);
return false;
}
tiles[tile_idx][build.height] = 0;
items_needed[ITEM_LABOUR] += cc::get_build_labour_cost_for_height(build.height);
while (!tiles[tile_idx].empty() && tiles[tile_idx].back() == 0)
tiles[tile_idx].pop_back();
++items_needed[decoded[idx]];

View File

@ -134,7 +134,7 @@ namespace cryptonote
uint8_t dy;
uint8_t wm1;
uint8_t hm1;
uint16_t min_height;
uint16_t height;
std::vector<uint8_t> block_data;
BEGIN_SERIALIZE_OBJECT()
@ -144,7 +144,7 @@ namespace cryptonote
FIELD(dy)
FIELD(wm1)
FIELD(hm1)
VARINT_FIELD(min_height)
VARINT_FIELD(height)
FIELD(block_data)
END_SERIALIZE()
};

View File

@ -103,7 +103,7 @@ bool GameState::process_build(const cryptonote::cc_command_build_t &cmd, Map &ma
MERROR("area not in flag");
return false;
}
if (!flag->push_tiles(NULL, flag->x0 + cmd.dx, flag->y0 + cmd.dy, flag->x0 + cmd.dx + cmd.wm1, flag->y0 + cmd.dy + cmd.hm1, cmd.min_height, cmd.block_data.data(), cmd.block_data.size()))
if (!flag->push_tiles(NULL, flag->x0 + cmd.dx, flag->y0 + cmd.dy, flag->x0 + cmd.dx + cmd.wm1, flag->y0 + cmd.dy + cmd.hm1, cmd.height, cmd.block_data.data(), cmd.block_data.size()))
{
MERROR("Failed to push tiles");
return false;

View File

@ -1355,7 +1355,7 @@ void CryptoCityUrho3D::AddBlock(bool use_selection)
cmd.push_area.dy = selection_y0 - flag->y0;
cmd.push_area.wm1 = selection_x1 - selection_x0;
cmd.push_area.hm1 = selection_y1 - selection_y0;
cmd.push_area.min_height = 0;
cmd.push_area.min_height = top_h;
uint32_t flag_budget[NUM_ITEMS];
static_assert(sizeof(flag_budget) == sizeof(flag->budget), "Size mismatch");
@ -1468,11 +1468,12 @@ void CryptoCityUrho3D::RemoveBlock(bool use_selection)
Command cmd;
cmd.type = Command::cmd_pop_area;
cmd.owner = gameState.playerState.id;
cmd.push_area.flag = flag->id;
cmd.push_area.dx = selection_x0 - flag->x0;
cmd.push_area.dy = selection_y0 - flag->y0;
cmd.push_area.wm1 = selection_x1 - selection_x0;
cmd.push_area.hm1 = selection_y1 - selection_y0;
cmd.pop_area.flag = flag->id;
cmd.pop_area.dx = selection_x0 - flag->x0;
cmd.pop_area.dy = selection_y0 - flag->y0;
cmd.pop_area.wm1 = selection_x1 - selection_x0;
cmd.pop_area.hm1 = selection_y1 - selection_y0;
cmd.pop_area.max_height = use_selection ? std::numeric_limits<uint16_t>::max() : mouse_h;
uint32_t cannot_remove = 0;
uint8_t raw_types[65536];
@ -1944,7 +1945,7 @@ void CryptoCityUrho3D::HandleApproveBuild(StringHash eventType, VariantMap& even
cmd.dy = by0 - flag->y0;
cmd.wm1 = bx1 - bx0;
cmd.hm1 = by1 - by0;
cmd.min_height = h;
cmd.height = h;
cmd.cc_parent = parent;
changed = false;

View File

@ -116,6 +116,16 @@ uint8_t Tile::get_type(uint16_t h) const
}
}
void Tile::set_type(uint16_t h, uint8_t type)
{
if (h >= height)
throw std::runtime_error("Height overflow");
if (height <= 8)
local_blocks[h] = type;
else
remote_blocks[h] = type;
}
Flag::Flag(uint32_t id, uint32_t owner, uint8_t role, uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, uint32_t repair, uint32_t economic_power, uint32_t stability, uint32_t potential): id(id), owner(owner), role(role), x0(x0), y0(y0), x1(x1), y1(y1), repair(repair), economic_power(economic_power), stability(stability), potential(potential), active(false)
{
const size_t w = x1 - x0 + 1;
@ -352,10 +362,18 @@ bool Flag::push_tiles(PlayerState *player, uint32_t px0, uint32_t py0, uint32_t
Tile &t = tiles[(ty-y0) * w + tx-x0];
if (decoded_types[done])
{
uint16_t build_height = std::max(min_height, t.get_height());
while (t.get_height() < build_height)
t.push(0);
t.push(decoded_types[done]);
uint16_t build_height;
for (build_height = min_height; build_height < t.get_height(); ++build_height)
if (t.get_type(build_height) == 0)
break;
if (build_height < t.get_height())
t.set_type(build_height, decoded_types[done]);
else
{
while (t.get_height() < build_height)
t.push(0);
t.push(decoded_types[done]);
}
}
++done;
}
@ -397,7 +415,7 @@ undo:
return false;
}
bool Flag::pop_tiles(PlayerState *player, uint32_t px0, uint32_t py0, uint32_t px1, uint32_t py1, const uint8_t *type_ptr, uint16_t type_len)
bool Flag::pop_tiles(PlayerState *player, uint32_t px0, uint32_t py0, uint32_t px1, uint32_t py1, uint16_t max_height, const uint8_t *type_ptr, uint16_t type_len)
{
if (px0 < x0 || px1 > x1 || py0 < y0 || py1 > y1)
{
@ -450,7 +468,10 @@ bool Flag::pop_tiles(PlayerState *player, uint32_t px0, uint32_t py0, uint32_t p
if (!decoded_types[done++])
continue;
Tile &t = tiles[(ty-y0) * w + tx-x0];
t.pop();
const uint16_t h = std::min<uint16_t>(t.get_height(), max_height);
t.set_type(h, 0);
while (t.get_height() > 0 && t.get_type(t.get_height() - 1) == 0)
t.pop();
// and track what height direct neighbours must be checked from
const uint16_t th = t.get_height();
check_height[tx-px0+1][ty-py0+1-1] = std::min(check_height[tx-px0+1][ty-py0+1-1], th);
@ -651,7 +672,7 @@ bool Map::push_tiles(PlayerState *player, uint32_t flag_id, uint8_t dx, uint8_t
return flag->push_tiles(player, flag->x0 + dx, flag->y0 + dy, flag->x0 + dx + wm1, flag->y0 + dy + hm1, min_height, type_ptr, type_len);
}
bool Map::pop_tiles(PlayerState *player, uint32_t flag_id, uint8_t dx, uint8_t dy, uint8_t wm1, uint8_t hm1, const uint8_t *type_ptr, uint16_t type_len)
bool Map::pop_tiles(PlayerState *player, uint32_t flag_id, uint8_t dx, uint8_t dy, uint8_t wm1, uint8_t hm1, uint16_t max_height, const uint8_t *type_ptr, uint16_t type_len)
{
if (!player || !player->id)
{
@ -664,7 +685,7 @@ bool Map::pop_tiles(PlayerState *player, uint32_t flag_id, uint8_t dx, uint8_t d
printf("Not owned\n");
return false;
}
return flag->pop_tiles(player, flag->x0 + dx, flag->y0 + dy, flag->x0 + dx + wm1, flag->y0 + dy + hm1, type_ptr, type_len);
return flag->pop_tiles(player, flag->x0 + dx, flag->y0 + dy, flag->x0 + dx + wm1, flag->y0 + dy + hm1, max_height, type_ptr, type_len);
}
bool Map::command(const Command &cmd, PlayerState *player)
@ -685,7 +706,7 @@ bool Map::command(const Command &cmd, PlayerState *player)
case Command::cmd_push_area:
return push_tiles(player, cmd.push_area.flag, cmd.push_area.dx, cmd.push_area.dy, cmd.push_area.wm1, cmd.push_area.hm1, cmd.push_area.min_height, cmd.push_area.type_ptr, cmd.push_area.type_len);
case Command::cmd_pop_area:
return pop_tiles(player, cmd.push_area.flag, cmd.pop_area.dx, cmd.pop_area.dy, cmd.pop_area.wm1, cmd.pop_area.hm1, cmd.push_area.type_ptr, cmd.push_area.type_len);
return pop_tiles(player, cmd.push_area.flag, cmd.pop_area.dx, cmd.pop_area.dy, cmd.pop_area.wm1, cmd.pop_area.hm1, cmd.pop_area.max_height, cmd.push_area.type_ptr, cmd.push_area.type_len);
default:
printf("Invalid command");
return false;

View File

@ -40,6 +40,7 @@ public:
void push(uint8_t type);
void pop();
uint8_t get_type(uint16_t h) const;
void set_type(uint16_t h, uint8_t type);
private:
uint16_t height;
@ -97,7 +98,7 @@ public:
std::vector<std::pair<uint32_t, uint32_t>> get_budget() const;
bool push_tiles(PlayerState *player, uint32_t px0, uint32_t py0, uint32_t px1, uint32_t py1, uint16_t min_height, const uint8_t *type_ptr, uint16_t type_len);
bool pop_tiles(PlayerState *player, uint32_t px0, uint32_t py0, uint32_t px1, uint32_t py1, const uint8_t *type_ptr, uint16_t type_len);
bool pop_tiles(PlayerState *player, uint32_t px0, uint32_t py0, uint32_t px1, uint32_t py1, uint16_t max_height, const uint8_t *type_ptr, uint16_t type_len);
bool build_predefined(const char *name, uint32_t bx0, uint32_t by0, uint32_t bx1, uint32_t by1);
@ -152,6 +153,7 @@ struct Command
uint8_t dy;
uint8_t wm1;
uint8_t hm1;
uint16_t max_height;
const uint8_t *type_ptr;
uint16_t type_len;
} pop_area;
@ -177,7 +179,7 @@ struct Map
// consensus
bool push_tiles(PlayerState *p, uint32_t flag_id, uint8_t dx, uint8_t dy, uint8_t wm1, uint8_t hm1, uint16_t min_height, const uint8_t *type_ptr, uint16_t type_len);
bool pop_tiles(PlayerState *p, uint32_t flag_id, uint8_t dx, uint8_t dy, uint8_t wm1, uint8_t hm1, const uint8_t *type_ptr, uint16_t type_len);
bool pop_tiles(PlayerState *p, uint32_t flag_id, uint8_t dx, uint8_t dy, uint8_t wm1, uint8_t hm1, uint16_t max_height, const uint8_t *type_ptr, uint16_t type_len);
bool command(const Command &cmd, PlayerState *player);
private:

View File

@ -263,7 +263,7 @@ namespace
const char* USAGE_CC_WITHDRAW("cc_withdraw <amount>");
const char* USAGE_CC_TRANSFER("cc_transfer <address> <amount>");
const char* USAGE_CC_BUY_LAND("cc_buy_land <x0> <y0> ( to <x1> <y1> | size <width> <height> ) [<city_id>])");
const char* USAGE_CC_BUILD("cc_build <flag> <dx> <dy> <width> <height> <list of blocks>)");
const char* USAGE_CC_BUILD("cc_build <flag> <dx> <dy> <width> <height> <build_height> <list of blocks>)");
const char* USAGE_CC_BUY_BLOCKS("cc_buy_blocks <type> <amount>");
const char* USAGE_CC_STATUS("cc_status");
const char* USAGE_HELP("help [<command>]");
@ -2539,7 +2539,7 @@ bool simple_wallet::cc_buy_land(const std::vector<std::string> &args_)
bool simple_wallet::cc_build(const std::vector<std::string> &args_)
{
if (args_.size() < 6)
if (args_.size() < 7)
{
fail_msg_writer() << "usage: " << USAGE_CC_BUILD;
return true;
@ -2575,14 +2575,20 @@ bool simple_wallet::cc_build(const std::vector<std::string> &args_)
fail_msg_writer() << tr("invalid height: must be an unsigned integer between 0 and 256");
return true;
}
uint16_t bh;
if (!string_tools::get_xtype_from_string(bh, args_[5]))
{
fail_msg_writer() << tr("invalid build height: must be an unsigned integer between 0 and 65535");
return true;
}
uint32_t n_tiles = w * h;
if (args_.size() != 5 + n_tiles)
if (args_.size() != 6 + n_tiles)
{
fail_msg_writer() << boost::format(tr("Wrong number of tiles, expected %u, got %zu")) % n_tiles % (args_.size() - 5);
return true;
}
std::vector<uint8_t> tiles;
unsigned int arg_idx = 5;
unsigned int arg_idx = 6;
while (n_tiles-- > 0)
{
uint32_t type;
@ -2601,7 +2607,7 @@ bool simple_wallet::cc_build(const std::vector<std::string> &args_)
cmd.dy = dy;
cmd.wm1 = w - 1;
cmd.hm1 = h - 1;
cmd.min_height = 0;
cmd.height = bh;
uint8_t encoded[65536];
uint32_t encoded_len = 0;
if (!cc::encode_blocks(tiles.data(), tiles.size(), encoded, &encoded_len))

View File

@ -4190,7 +4190,7 @@ namespace tools
cmd.dy = req.dy;
cmd.wm1 = req.width - 1;
cmd.hm1 = req.height - 1;
cmd.min_height = req.min_height;
cmd.height = req.build_height;
if (req.encoded)
{
cmd.block_data = req.block_data;

View File

@ -2678,7 +2678,7 @@ namespace wallet_rpc
uint8_t dy;
uint8_t width;
uint8_t height;
uint16_t min_height;
uint16_t build_height;
std::vector<uint8_t> block_data;
bool encoded;
uint64_t parent;
@ -2693,7 +2693,7 @@ namespace wallet_rpc
KV_SERIALIZE(dy)
KV_SERIALIZE(width)
KV_SERIALIZE(height)
KV_SERIALIZE(min_height)
KV_SERIALIZE(build_height)
KV_SERIALIZE(block_data)
KV_SERIALIZE(encoded)
KV_SERIALIZE(parent)

View File

@ -1284,7 +1284,7 @@ bool gen_cc_tx_valid_cc_bare_build_whole_flag::generate(std::vector<test_event_e
cmd.dy = 0;
cmd.wm1 = 3;
cmd.hm1 = 3;
cmd.min_height = 0;
cmd.height = 0;
static const uint8_t S = ITEM_BASIC_STONE;
static const uint8_t block_data[] = { 16-1, 0, S, 0, S, 0, S, 0, S, 0, S, 0, S, 0, S, 0, S };
cmd.block_data = std::vector<uint8_t>(block_data, block_data + sizeof(block_data));
@ -1337,7 +1337,7 @@ bool gen_cc_tx_valid_cc_bare_build_part_of_flag::generate(std::vector<test_event
cmd.dy = 2;
cmd.wm1 = 1;
cmd.hm1 = 1;
cmd.min_height = 0;
cmd.height = 0;
static const uint8_t S = ITEM_BASIC_STONE;
static const uint8_t block_data[] = { 4-1, 0, S, 0, S };
cmd.block_data = std::vector<uint8_t>(block_data, block_data + sizeof(block_data));
@ -1381,7 +1381,7 @@ bool gen_cc_tx_invalid_cc_bare_build_out_of_flag::generate(std::vector<test_even
cmd.dy = 2;
cmd.wm1 = 0;
cmd.hm1 = 5;
cmd.min_height = 0;
cmd.height = 0;
static const uint8_t S = ITEM_BASIC_STONE;
static const uint8_t block_data[] = { 6-1, 0, S, 0, S, 0, S };
cmd.block_data = std::vector<uint8_t>(block_data, block_data + sizeof(block_data));
@ -1410,7 +1410,7 @@ bool gen_cc_tx_invalid_cc_bare_build_invalid_flag::generate(std::vector<test_eve
cmd.dy = 2;
cmd.wm1 = 1;
cmd.hm1 = 1;
cmd.min_height = 0;
cmd.height = 0;
static const uint8_t S = ITEM_BASIC_STONE;
static const uint8_t block_data[] = { 4-1, 0, S, 0, S };
cmd.block_data = std::vector<uint8_t>(block_data, block_data + sizeof(block_data));
@ -1433,7 +1433,7 @@ bool gen_cc_tx_invalid_cc_bare_build_not_owned::generate(std::vector<test_event_
cmd.dy = 2;
cmd.wm1 = 1;
cmd.hm1 = 1;
cmd.min_height = 0;
cmd.height = 0;
static const uint8_t S = ITEM_BASIC_STONE;
static const uint8_t block_data[] = { 4-1, 0, S, 0, S };
cmd.block_data = std::vector<uint8_t>(block_data, block_data + sizeof(block_data));
@ -1462,7 +1462,7 @@ bool gen_cc_tx_invalid_cc_bare_build_too_long_decoded_block_data::generate(std::
cmd.dy = 2;
cmd.wm1 = 1;
cmd.hm1 = 1;
cmd.min_height = 0;
cmd.height = 0;
static const uint8_t S = ITEM_BASIC_STONE;
static const uint8_t block_data[] = { 5-1, 0, S, 0, S, 0 };
cmd.block_data = std::vector<uint8_t>(block_data, block_data + sizeof(block_data));
@ -1500,7 +1500,7 @@ bool gen_cc_tx_valid_cc_bare_build_stacked::generate(std::vector<test_event_entr
cmd.dy = 2;
cmd.wm1 = 1;
cmd.hm1 = 1;
cmd.min_height = 0;
cmd.height = 0;
static const uint8_t S = ITEM_BASIC_STONE;
static const uint8_t W = ITEM_BASIC_WOOD;
static const uint8_t block_data0[] = { 4-1, 0, S, 0, S };
@ -1508,34 +1508,38 @@ bool gen_cc_tx_valid_cc_bare_build_stacked::generate(std::vector<test_event_entr
cmds.push_back(std::make_tuple("", cmd, BARE_TX_FEE));
// build on top of some of them
static const uint8_t block_data1[] = { 4-1, 0, S, 0, 0 };
static const uint8_t block_data1[] = { 4-1, S, 0, 0, 0 };
cmd.block_data = std::vector<uint8_t>(block_data1, block_data1 + sizeof(block_data1));
cmds.push_back(std::make_tuple("", cmd, BARE_TX_FEE));
// build on top of others, they'll stack at different heights this time
static const uint8_t block_data2[] = { 4-1, S, S, W, 0 };
static const uint8_t block_data2[] = { 4-1, 0, 0, W, 0 };
cmd.block_data = std::vector<uint8_t>(block_data2, block_data2 + sizeof(block_data2));
cmds.push_back(std::make_tuple("", cmd, BARE_TX_FEE));
// build on another overlapping area
cmd.dy = 1;
static const uint8_t block_data3[] = { 4-1, S, S, 0, S };
// build on top of others
cmd.height = 1;
static const uint8_t block_data3[] = { 4-1, S, S, 0, W};
cmd.block_data = std::vector<uint8_t>(block_data3, block_data3 + sizeof(block_data3));
cmds.push_back(std::make_tuple("", cmd, BARE_TX_FEE));
// one with min height
cmd.dy = 2;
cmd.min_height = 2;
static const uint8_t block_data4[] = { 4-1, 0, S, S, 0 };
cmd.dy = 1;
static const uint8_t block_data4[] = { 4-1, S, S, 0, 0};
cmd.block_data = std::vector<uint8_t>(block_data4, block_data4 + sizeof(block_data4));
cmds.push_back(std::make_tuple("", cmd, BARE_TX_FEE));
// and then check one on top of a min height'd one stays on top
cmd.min_height = 0;
static const uint8_t block_data5[] = { 4-1, S, S, S, W };
// build on another overlapping area
cmd.height = 2;
cmd.dx = 0;
static const uint8_t block_data5[] = { 4-1, 0, S, S, S };
cmd.block_data = std::vector<uint8_t>(block_data5, block_data5 + sizeof(block_data5));
cmds.push_back(std::make_tuple("", cmd, BARE_TX_FEE));
// build under existing geometry
cmd.height = 1;
static const uint8_t block_data6[] = { 4-1, W, 0, W, 0 };
cmd.block_data = std::vector<uint8_t>(block_data6, block_data6 + sizeof(block_data6));
cmds.push_back(std::make_tuple("", cmd, BARE_TX_FEE));
return generate_with(events, boost::none, boost::none, prep_buy_stuff, cmds.size(), mixin, amount_paid, true, cmds, false, valid, NULL, NULL);
}
@ -1544,7 +1548,7 @@ bool gen_cc_tx_valid_cc_bare_build_stacked::check_final_state(cryptonote::core &
static const uint8_t S = ITEM_BASIC_STONE;
static const uint8_t W = ITEM_BASIC_WOOD;
return log_test_accounts(c, events)
&& expect_cc_account(c, 0, 4, expected_balance[0] - 8 * BARE_TX_FEE)
&& expect_cc_account(c, 0, 4, expected_balance[0] - 9 * BARE_TX_FEE)
&& expect_cc_account(c, 1, 5, expected_balance[1])
&& expect_cc_account(c, 2, 6, expected_balance[2])
&& expect_cc_account(c, 3, 7, expected_balance[3])
@ -1553,12 +1557,12 @@ bool gen_cc_tx_valid_cc_bare_build_stacked::check_final_state(cryptonote::core &
&& expect_cc_account(c, 6, 10, initial_funding[6])
&& expect_cc_account(c, 7, 11, initial_funding[7])
&& expect_treasury_balance(c, expected_treasury_balance)
&& expect_flag_tiles(c, 1, {{}, {}, {}, {}, {}, {},
{}, {S}, {S}, {}, {}, {},
{}, {S,S}, {S,S,S,S,S,S}, {}, {}, {},
{}, {W,0,S,S}, {S,W}, {}, {}, {},
{}, {}, {}, {}, {}, {},
{}, {}, {}, {}, {}, {} });
&& expect_flag_tiles(c, 1, {{}, {}, {}, {}, {}, {},
{0,W}, {0,S,S}, {0,S}, {}, {}, {},
{0,W,S}, {S,S,S}, {S,S}, {}, {}, {},
{}, {W}, {S,W}, {}, {}, {},
{}, {}, {}, {}, {}, {},
{}, {}, {}, {}, {}, {} });
}
bool gen_cc_tx_invalid_cc_bare_build_not_enough_blocks::generate(std::vector<test_event_entry>& events) const
@ -1581,7 +1585,7 @@ bool gen_cc_tx_invalid_cc_bare_build_not_enough_blocks::generate(std::vector<tes
cmd.dy = 0;
cmd.wm1 = 5;
cmd.hm1 = 4;
cmd.min_height = 0;
cmd.height = 0;
static const uint8_t S = ITEM_BASIC_STONE;
static const uint8_t block_data[] = { 30-1, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S, S};
cmd.block_data = std::vector<uint8_t>(block_data, block_data + sizeof(block_data));

View File

@ -724,7 +724,7 @@ TEST(cc_command, build)
cmd.dy = 50;
cmd.wm1 = 8;
cmd.hm1 = 4;
cmd.min_height = 0;
cmd.height = 0;
uint64_t cc_in = (uint64_t)-1, cc_out = (uint64_t)-1;
cc::get_cc_command_in_out(cmd, cc_in, cc_out);
ASSERT_EQ(cc_in, 0);
@ -1147,7 +1147,7 @@ TEST(cc_command, execute_build)
build.dy = 1;
build.wm1 = 2;
build.hm1 = 2;
build.min_height = 0;
build.height = 0;
build.block_data = std::vector<uint8_t>(block_data, block_data + sizeof(block_data));
test_commands(true, setup, build, "valid");
}

View File

@ -1101,7 +1101,7 @@ class Wallet(object):
}
return self.rpc.send_json_rpc_request(cc_buy_land)
def cc_build(self, flag, dx, dy, width, height, block_data, encoded, min_height = 0, parent = 0, priority = 0, do_not_relay = False, get_tx_hex = False, get_tx_metadata = False):
def cc_build(self, flag, dx, dy, width, height, block_data, encoded, build_height = 0, parent = 0, priority = 0, do_not_relay = False, get_tx_hex = False, get_tx_metadata = False):
cc_build = {
'method': 'cc_build',
'params': {
@ -1112,7 +1112,7 @@ class Wallet(object):
'height': height,
'block_data': block_data,
'encoded': encoded,
'min_height': min_height,
'build_height': build_height,
'parent': parent,
'priority': priority,
'do_not_relay': do_not_relay,