Bitcore not signing nlocktimetx correctly

I’m having issues creating an nlocktimetx - partictularly broadcasting this serialized tx after the transaction has been signed. This code very naively tries to sign the first utxo found by insight. I am unable to broadcast the signed transaction - every thing is giving me an error saying that the tx was either a double spend (not the case) or formatted incorrectly. The transaction is fully signed. I know this because the if(tx.isFullySigned()) predicate evalutes to true during the execution of this code. However if I try and broadcast this tx after the lock has expired the transaction is still invalid

function createNLockTimeTx(fromAddress, toAddress, lockExpirationDate, privateKey){
$("#signedNLockTimeTx").removeClass(“errorInputText”)
//var date = new Date(lockExpirationDate);
//30 min lock time for testing
var date = new Date(new Date().getTime() + 30*60000);
insight.getUnspentUtxos(fromAddress, function(err, utxos) {
if (err) {
throw err
} else {
console.log("From Address: " + fromAddress.toString())
console.log(“To Address: " + toAddress.toString())
console.log(utxos)
for (i =0 ; i < utxos.length; i++ ) {
console.log(utxos[i])
}
var amount = utxos[0].satoshis - txFee
var tx = new bitcore.Transaction().from(utxos).to(toAddress,amount).lockUntilDate(date).change(toAddress)
//legacy issues with bitcoin, have to have the sequence number set to less than 0xfffffff
tx.inputs[0].sequenceNumber = 0
tx.sign(privateKey);
console.log(tx)
console.log(“Tx fully signed: " + tx.isFullySigned())
console.log(“Tx verify: " + tx.verify())
//console.log(“Tx verifySignature: " + tx.verifySignature())
$(”#nLockTimeTx”).val(tx.serialize());
console.log(”======”)
console.log(tx.serialize());

        if (tx.isFullySigned()) {
            $("#signedNLockTimeTxHeading").text("Signed nLockTimeTx: ")
            $("#signedNLockTimeTx").val(tx.serialize())
        } else {
            $("#signedNLockTimeTx").addClass("errorInputText")
            $("#signedNLockTimeTx").val("You provided a private key that was incorrect. If you are sure this was the correct" +
            " key try giving the key in WIF format")

        }

  }
});

}

Does anyone see what I am doing incorrectly?

All seems right. Can you try to decode the raw transaction with bitcoin-cli? By decoding the serialized tx you could get some hits of what is the problem.

(bitcoin decoderawtransaction <hex>) or an online tool like ( https://blockchain.info/decode-tx or https://coinb.in/#verify).

Here is the example of a signed transaction I am creating - this is using the test network:

010000000100ba8a19efdf3ef9fd12d57368a2289121aa003379bd545674f869fa959041a0010000008b483045022100d2ec00117f6b85ed375aa5c48ddcb346987e62eb122945c3a6aaabaeb5287237022017129136548cf64e7cfc8be79971232ea1850ae3eab7b3bd80e2e612b23feb5f0141045fca519d55af86ce45ef915fed6e8ba20733b699cb10cef1cafbc47a789d8ae49e9b23e345e9d82ca7c920fd4b30a8add2f737aae84ae0c5830481a89b34bdf4000000000100530700000000001976a9143dc0cf4226cd89f7a9f32490e0e1c5454b86f7d988ac10657855

I am using https://tbtc.blockr.io to deserialize and verify the tx - which evalutes just fine on blockr. However when the lock time expires and it becomes a valid tx to push the network rejects it.

Note that the originating address is: mv8vxFPszZrWFLNErRL6DfUdEsehdvowKS

The lock time on that transaction expires in roughly 30 minutes.